Community Documentation

Default baseline variables

Last updated March 1, 2013. Created by LeeHunter on February 26, 2008.
Edited by inventlogic, Carolyn, bekasu, dvessel. Log in to edit this page.

The following are the baseline variables available to all template files. They are generated through the preprocessor function, template_preprocess Drupal 6 or template_preprocess Drupal 7. Variables specific to the template are documented inside the file.

New Variables available in D7

$attributes_array
$title_attributes_array
$content_attributes_array
$classes_array
Array of html class attribute values. It is flattened into a string within the variable $classes.
$title_prefix
An array containing additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.
$title_suffix
An array containing additional output populated by modules, intended to be displayed after the main title tag that appears in the template.

Variables available in both D6 and D7

$id
The placement of the template. Each time the template is used, it is incremented by one.
$zebra
Either "odd" or "even". Alternate each time the template is used.
$directory
The theme path relative to the base install. example: "sites/all/themes/myTheme"
$is_admin
Boolean returns TRUE when the visitor is a site administrator.
$is_front
Boolean returns TRUE when viewing the front page of the site.
$logged_in
Boolean returns TRUE when the visitor is a member of the site, logged in and authenticated.
$db_is_active
Boolean returns TRUE when the database is active and running. This is only useful for theming in maintenance mode where the site may run into database problems.
$user
The user object containing data for the current visitor. Some of the data contained here may not be safe. Be sure to pass potentially dangerous strings through check_plain.

Comments

regarding $id

hi
simple query from a drupal noob, is the $id mentioned here same as that in node.tpl.php in system dir?

because i can't seem to understand the meaning of

The placement of the template

any explanations would be helpful.

When i use a word i define what it means ,not more not less

nobody click here