Last updated August 24, 2009. Created by ksenzee on August 30, 2007.
Edited by alexanderpas, joachim, skiquel. Log in to edit this page.
PHPTemplate offers a variable in page.tpl.php which is rather powerful if you know how to use it.
Drupal 5 ($layout)
$layout contains a string telling you what the page layout is:left if the left sidebar is in useright if the right sidebar is in useboth if both sidebars are in use
Drupal 6 ($body_classes)
Even more powerful, the $body_classes variable contains some useful information, separated by spaces, that you can utilize in your css classes.
- On the front page? front / not_front
- Logged in or logged out? logged-in / not-logged-in
- What node are we on? node-type-??
- What are our sidebars doing? two-sidebars / one-sidebar sidebar-left / one-sidebar sidebar-right / no-sidebars
Some Drupal 5 themes already implement these classes, eg Zen.
Using it to your advantage
When you place these variables in classes, you can more easily make your theme more versatile by being able to handle the diverse block settings users will choose. The strings these variables contain are purposely designed to be used in CSS classes.