O'Reilly logo

Drupal 7 Themes by Ric Shreves

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dynamically theming page elements

In addition to being able to style particular pages or groups of pages, Drupal makes it possible to provide specific styling for different page elements.

Associating elements with the front page

Drupal provides $is_front as a means of determining whether the page currently displayed is the front page. $is_frontis set to true if Drupal is rendering the front page; otherwise it is set to false.

We can use $is_front in our page.tpl.php file to help toggle the display of items we want to associate with the front page. To display an element on only the front page, make it conditional on the state of $is_front. For example, to display the site slogan on only the front page of the site, wrap $site_slogan (in your page.tpl.php ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required