Hi,
total newbie. Running first drupal site. learning lots, enjoying it...mostly. I have a snippet on the front page that I only want to display when the user is on the front page (ie. first load of site, or click on 'home'). How do i do that?

Is there an ishome() kind of function?
Cheers,
Dan

Comments

nevets’s picture

If your snippet is just HTML you could place it in the mission statement which Drupal only shows on the frontpage. Placement of the mission statement iscontrolled by page.tpl.php and the $mission variable.

From within a template file (page.tpl.php, node.tpl.php, block.tpl.php, etc) you can use $is_front. In other cases you can call drupal_is_front_page().

dvessel’s picture

<?php if($is_front) { ?>
  ...your snippet...
<?php } ?>

is all it takes. Install the devel module. It can print out the variables available to you. The above is checking for $is_front which is set in "administration > settings" for the front page.

http://drupal.org/project/devel

edit:: beat me to it..

joon