Page.tpl.php
Concept · Reference · page template code explained · page theming · what is a page in drupal · Drupal 4.5.x or older · Drupal 4.6.x · Drupal 4.7.x · Drupal 5.x
Last modified: August 26, 2009 - 22:42
This template defines the main skeleton for the page.
Available variables (Alphabetical)
- $base_path
- Returns the base URL path of the Drupal installation. At the very least, this will always default to /.
- $breadcrumb
- HTML for displaying the breadcrumbs at the top of the page.
- $closure
- Needs to be displayed at the bottom of the page, for any dynamic javascript that needs to be called once the page has already been displayed.
- $content
- The HTML content generated by Drupal to be displayed.
- $css
- An array of all the CSS files for the current page.
- $directory
- The directory the theme is located in, e.g.
- themes/garland or themes/garland/minelli.
- $feed_icons
- A string of all feed icons for the current page.
- $footer_message
- The footer message as defined in the admin settings, also the HTML for the footer region.
- $head
- HTML as generated by drupal_get_html_head().
- $head_title
- The text to be displayed in the page title.
- $header
- HTML for the header region.
- $help
- Dynamic help text, mostly for admin pages.
- $is_front
- True if the front page is currently being displayed. Used to toggle the mission.
- $language
- The language the site is being displayed in.
- $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
- The path to the logo image, as defined in theme configuration.
- $messages
- HTML for status and error messages, to be displayed at the top of the page.
- $mission
- The text of the site mission, empty when display has been disabled in theme settings.
- $node
- (5.x and after only) If you are in page.tpl.php displaying a node in full page view then $node is available to your template.
- $onload_attribute
- (4.7 and older only) Onload tags to be added to the head tag, to allow for autoexecution of attached scripts.
- $primary_links (array)
- An array containing the links as they have been defined in the phptemplate specific configuration block.
- $scripts
- (5.x and after only) HTML to load the JavaScript files and make the JS settings available. Previously, javascript files are hardcoded into the page.tpl.php
- $search_box
- True(1) if the search box has been enabled.
- $search_button_text
- (4.7 and older only)Translated text on the search button.
- $search_description
- (4.7 and older only)Translated description for the search button.
- $search_url
- (4.7 and older only)URL the search form is submitted to.
- $secondary_links (array)
- An array containing the links as they have been defined in the phptemplate specific configuration block.
- $sidebar_left
- The HTML for the left sidebar.
- $sidebar_right
- The HTML for the right sidebar.
- $site_name
- The name of the site, empty when display has been disabled in theme settings.
- $site_slogan
- The slogan of the site, empty when display has been disabled in theme settings.
- $styles
- Required for stylesheet switching to work. This prints out the style tags required.
- $tabs
- HTML for displaying tabs at the top of the page.
- $title
- Title, different from head_title, as this is just the node title most of the time.
See also page.tpl.php for Drupal 6 and higher.
Default template
Here is the contents of the bluemarine template's page.tpl.php for Drupal 5, to give you an idea of the layout of the file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<script type="text/javascript"><?php /* Needed to avoid Flash of Unstyle Content in IE */ ?> </script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" id="header">
<tr>
<td id="logo">
<?php if ($logo) { ?><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a><?php } ?>
<?php if ($site_name) { ?><h1 class='site-name'><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></h1><?php } ?>
<?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
</td>
<td id="menu">
<?php if (isset($secondary_links)) { ?><?php print theme('links', $secondary_links, array('class' =>'links', 'id' => 'subnavlist')) ?><?php } ?>
<?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' =>'links', 'id' => 'navlist')) ?><?php } ?>
<?php print $search_box ?>
</td>
</tr>
<tr>
<td colspan="2"><div><?php print $header ?></div></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" id="content">
<tr>
<?php if ($sidebar_left) { ?><td id="sidebar-left">
<?php print $sidebar_left ?>
</td><?php } ?>
<td valign="top">
<?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><?php } ?>
<div id="main">
<?php print $breadcrumb ?>
<h1 class="title"><?php print $title ?></h1>
<div class="tabs"><?php print $tabs ?></div>
<?php print $help ?>
<?php print $messages ?>
<?php print $content; ?>
<?php print $feed_icons; ?>
</div>
</td>
<?php if ($sidebar_right) { ?><td id="sidebar-right">
<?php print $sidebar_right ?>
</td><?php } ?>
</tr>
</table>
<div id="footer">
<?php print $footer_message ?>
</div>
<?php print $closure ?>
</body>
</html>
How do these Variables get into the Theme / Template?
Hi there,
I am wondering how these variables get into the theme / template?
Do I have a chance to reach them in a custom module of mine?
--
anmut und demut
using custom node
you can modify the varible or the theme using node.tpl.php
---
Drupal Development Services
How to insert a variable link $teaser in Page.tpl.php
Hy to all...
How can I make avaiable a variable like $teaser or $is_front inside the page.tpl.php file?
Is possible to do...??
(probably with a template.php function?)
Thanks to all, bye!
I notice that variable
I notice that variable $is_front works correctly aon pge.tpl.php tempalte file...
Still remain my problem to have something like "$teaser" ot "$page == 0" for page.tpl.php file (they works good on node.tpl.php file template).
Thanks, Bye!
Found It!
To insert some come Only for Taxonomy page, i page.tpl.php tempalte file, is usefull:
<?php if (arg(0) == 'taxonomy') {?> Here thecode <?php }; ?>Changes to page.tpl.php not showing up?
I changed the footer message in my page.tpl.php file, cleared all cached, and even ran update.php...but still the old version of the footer shows up on the site? Also cleared my browser cache, but still no dice.
I checked the file, and the new information is definitely there, but I can't get it to show up...any suggestions?
Mark