$page==0 or $is_front

Last modified: August 23, 2009 - 14:57

If you plan to use the $page or $is_front variables in a conditional statement here is a good thread (especially read the comments) that discusses the difference between the two variables.

Simply put $is_front is set only when you are on the front page of the site. The $is_front variable is not set for "listing" pages, e.g. if you click on a taxonomy term and get a listing of nodes classified under that taxonomy term.

$page is equal to 0 for all "listing" pages such as taxonomy term pages.

Code Examples

<?php if ($is_front): ?>
  <p>This will only appear on the front page.</p>
<?php endif; ?>

<?php if ($page == 0): ?>
  <p>This will appear on listing type pages.</p>
<?php endif; ?>

 
 

Drupal is a registered trademark of Dries Buytaert.