Default baseline variables
Last updated on
31 August 2016
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
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
$title_prefix
$title_suffix
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.
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion