Drupal: Variables of page.tpl.php
In this article, we will make clear of page template variables (page.tpl.php) to properly adjust design of your Drupal-based site.
Solution:
page.tpl.php is a template that forms a page. Please read the list & description of variables below. You could use these variables adjusting design of your site.
- $base_path — path to Drupal folder.
- $css — CSS-files.
- $breadcrumb — breadcrump.
- $closure — informs about closing a page.
- $content — node content.
- $directory — folder with a theme (e.g. sites/all/themes/MyTheme).
- $feed_icons — RSS icon.
- $footer_message — information shown in the lower column. It is taken from settings at Administer > Site configuration > Site information. It is empty is these is no info specified in Footer message field.
- $head — HTML as generated by drupal_get_html_head().
- $head_title — variable shows: «node title| site title». It is usually inserted to the HTML-tag and is shown in a title in browser window .
- $help — help. Shows messages for administrator’s pages mostly. For example, if you click Administer link, you will see a message: «Welcome to the administration section. Here you may control how your site functions». If you have no this variable in your template, you won’t see the help message.
- $is_front — returns 1 (true) if the first site page is loaded and 0 (false) if any other page is loaded.
- $language — shows language of a site to help browser determine encoding. Is taken from Administer > Site configuration > Localization.
- $layout — this setting allows you to style different types of layout (‘none’, ‘left’, ‘right’ or ‘both’) differently, depending on how many sidebars are enabled.
- $logo — logo address. The data is taken from theme settings. If settings disable showing of a logo, it won’t be shown.
- $messages — context messages about status and errors. Is shown at the top of a page. For example, if alias doesn’t correspond with password, you will see this message: «Sorry, unrecognized username or password. Have you forgotten your password?» If there is no this variable in a template, a page will be reloaded without an error message.
- $mission — mission indo. Is taken from Administer > Site configuration > Site information. If Mission is specified, but disabled in a theme settings, the info won’t appear.
- $node — verification variable: to show in open documents only.
- $onload_attributes — onload tags to be added to the head tag, to allow for auto execution of attached scripts.
- $primary_links (array) — Primary links output.
- $scripts — loads JS script files. Before v 5.0 JS code was recorder to page.tpl.php.
- $search_box — search format. If Search module isn’t activated or is disabled in a theme settings, it won’t appear for your site.
- $search_button_text — translated text on the search button.
- $search_description — translated description for the search button.
- $search_url — URL the search form is submitted to.
- $secondary_links (array) — Secondary links output.
- $sidebar_left — left column.
- $sidebar_right — right column.
- $site — the name of the site, always filled in.
- $site_name — name of a site. If showing of site name is disabled in a theme settings, it won’t appear.
- $site_slogan — site slogan. Won’t appear if it is disabled in a theme settings.
- $styles — styles loading. By default this is style.css file from theme folder and .css-files in modules folders.
- $tabs — tabs. If youo go to Administer link there would be By task and By module tabs. If you have read and write permission for nodes, these would be View, Edit tabs etc.
- $title — node title.
I think this is a real great article post.Really thank you! Really Cool.