Hi,
i'm looking to achieve two separates things on page.tpl.php :

1) have a code displayed only on the frontpage.

2) Have a code displayed only for unregistered user, if not unregistered (registered) display other code.

How can I do this ?

Thanks,
Brakkar

Comments

WorldFallz’s picture

Probably the simplest way is with the http://drupal.org/project/front module.

Robardi56’s picture

Thanks, but I would prefer code versions, in particular for 2) that may also appear on other page than the frontpage.

jaypan’s picture

You can use the variable $is_front to determine if the user is on the front page. This variable is TRUE for the front page and FALSE for all other pages.

To determine if a user is logged in, you can use the function user_is_anonymous().

Contact me to contract me for D7 -> D10/11 migrations.

yelvington’s picture

http://api.drupal.org/api/drupal/modules--system--page.tpl.php

        General utility variables:

$base_path: The base URL path of the Drupal installation. At the very least, this will always default to /.
$css: An array of CSS files for the current page.
$directory: The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
$is_front: TRUE if the current page is the front page. Used to toggle the mission statement.
$logged_in: TRUE if the user is registered and signed in.
$is_admin: TRUE if the user has permission to access administration pages.
if($is_front && $logged_in) print "you are logged in, and looking at the front page";