page.tpl.php

You are here

  1. 7 themes/garland/page.tpl.php
  2. 7 modules/block/tests/themes/block_test_theme/page.tpl.php
  3. 7 themes/bartik/templates/page.tpl.php
  4. 7 modules/system/page.tpl.php
  5. 7 themes/seven/page.tpl.php
  6. 4.7 themes/pushbutton/page.tpl.php
  7. 4.7 themes/bluemarine/page.tpl.php
  8. 5 themes/bluemarine/page.tpl.php
  9. 5 themes/pushbutton/page.tpl.php
  10. 5 themes/garland/page.tpl.php
  11. 6 themes/pushbutton/page.tpl.php
  12. 6 themes/garland/page.tpl.php
  13. 6 themes/bluemarine/page.tpl.php
  14. 6 modules/system/page.tpl.php

Displays a single Drupal page.

Available variables:

General utility variables:

  • $base_path: The base URL path of the Drupal installation. At the very least, this will always default to /.
  • $css: An array of CSS files for the current page.
  • $directory: The directory the theme is located in, e.g. themes/garland or themes/garland/minelli.
  • $is_front: TRUE if the current page is the front page.
  • $logged_in: TRUE if the user is registered and signed in.
  • $is_admin: TRUE if the user has permission to access administration pages.

Page metadata:

  • $language: (object) The language the site is being displayed in. $language->language contains its textual representation. $language->dir contains the language direction. It will either be 'ltr' or 'rtl'.
  • $head_title: A modified version of the page title, for use in the TITLE element.
  • $head: Markup for the HEAD element (including meta tags, keyword tags, and so on).
  • $styles: Style tags necessary to import all CSS files for the page.
  • $scripts: Script tags necessary to load the JavaScript files and settings for the page.
  • $body_classes: A set of CSS classes for the BODY tag. This contains flags indicating the current layout (multiple columns, single column), the current path, whether the user is logged in, and so on.

Site identity:

  • $front_page: The URL of the front page. Use this instead of $base_path, when linking to the front page. This includes the language domain or prefix.
  • $logo: The path to the logo image, as defined in theme configuration.
  • $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.
  • $mission: The text of the site mission, empty when display has been disabled in theme settings.

Navigation:

  • $search_box: HTML to display the search box, empty if search has been disabled.
  • $primary_links (array): An array containing primary navigation links for the site, if they have been configured.
  • $secondary_links (array): An array containing secondary navigation links for the site, if they have been configured.

Page content (in order of occurrence in the default page.tpl.php):

  • $left: The HTML for the left sidebar.
  • $breadcrumb: The breadcrumb trail for the current page.
  • $title: The page title, for use in the actual HTML content.
  • $help: Dynamic help text, mostly for admin pages.
  • $messages: HTML for status and error messages. Should be displayed prominently.
  • $tabs: Tabs linking to any sub-pages beneath the current page (e.g., the view and edit tabs when displaying a node).
  • $content: The main content of the current Drupal page.
  • $right: The HTML for the right sidebar.
  • $node: The node object, if there is an automatically-loaded node associated with the page, and the node ID is the second argument in the page's path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).

Footer/closing data:

  • $feed_icons: A string of all feed icons for the current page.
  • $footer_message: The footer message as defined in the admin settings.
  • $footer : The footer region.
  • $closure: Final closing markup from any modules that have altered the page. This variable should always be output last, after all other dynamic content.

See also

template_preprocess()

template_preprocess_page()

4 theme calls to page.tpl.php
drupal_access_denied in includes/common.inc
Generates a 403 error if the request is not allowed.
drupal_not_found in includes/common.inc
Generates a 404 error if the request can not be handled.
index.php in ./index.php
The PHP page that serves all page requests on a Drupal installation.
system_batch_page in modules/system/system.admin.inc
Default page callback for batches.

File

modules/system/page.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Displays a single Drupal page.
  5. *
  6. * Available variables:
  7. *
  8. * General utility variables:
  9. * - $base_path: The base URL path of the Drupal installation. At the very
  10. * least, this will always default to /.
  11. * - $css: An array of CSS files for the current page.
  12. * - $directory: The directory the theme is located in, e.g. themes/garland or
  13. * themes/garland/minelli.
  14. * - $is_front: TRUE if the current page is the front page.
  15. * - $logged_in: TRUE if the user is registered and signed in.
  16. * - $is_admin: TRUE if the user has permission to access administration pages.
  17. *
  18. * Page metadata:
  19. * - $language: (object) The language the site is being displayed in.
  20. * $language->language contains its textual representation.
  21. * $language->dir contains the language direction. It will either be 'ltr' or
  22. * 'rtl'.
  23. * - $head_title: A modified version of the page title, for use in the TITLE
  24. * element.
  25. * - $head: Markup for the HEAD element (including meta tags, keyword tags, and
  26. * so on).
  27. * - $styles: Style tags necessary to import all CSS files for the page.
  28. * - $scripts: Script tags necessary to load the JavaScript files and settings
  29. * for the page.
  30. * - $body_classes: A set of CSS classes for the BODY tag. This contains flags
  31. * indicating the current layout (multiple columns, single column), the
  32. * current path, whether the user is logged in, and so on.
  33. *
  34. * Site identity:
  35. * - $front_page: The URL of the front page. Use this instead of $base_path,
  36. * when linking to the front page. This includes the language domain or
  37. * prefix.
  38. * - $logo: The path to the logo image, as defined in theme configuration.
  39. * - $site_name: The name of the site, empty when display has been disabled in
  40. * theme settings.
  41. * - $site_slogan: The slogan of the site, empty when display has been disabled
  42. * in theme settings.
  43. * - $mission: The text of the site mission, empty when display has been
  44. * disabled in theme settings.
  45. *
  46. * Navigation:
  47. * - $search_box: HTML to display the search box, empty if search has been
  48. * disabled.
  49. * - $primary_links (array): An array containing primary navigation links for
  50. * the site, if they have been configured.
  51. * - $secondary_links (array): An array containing secondary navigation links
  52. * for the site, if they have been configured.
  53. *
  54. * Page content (in order of occurrence in the default page.tpl.php):
  55. * - $left: The HTML for the left sidebar.
  56. * - $breadcrumb: The breadcrumb trail for the current page.
  57. * - $title: The page title, for use in the actual HTML content.
  58. * - $help: Dynamic help text, mostly for admin pages.
  59. * - $messages: HTML for status and error messages. Should be displayed
  60. * prominently.
  61. * - $tabs: Tabs linking to any sub-pages beneath the current page (e.g., the
  62. * view and edit tabs when displaying a node).
  63. * - $content: The main content of the current Drupal page.
  64. * - $right: The HTML for the right sidebar.
  65. * - $node: The node object, if there is an automatically-loaded node associated
  66. * with the page, and the node ID is the second argument in the page's path
  67. * (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).
  68. *
  69. * Footer/closing data:
  70. * - $feed_icons: A string of all feed icons for the current page.
  71. * - $footer_message: The footer message as defined in the admin settings.
  72. * - $footer : The footer region.
  73. * - $closure: Final closing markup from any modules that have altered the page.
  74. * This variable should always be output last, after all other dynamic
  75. * content.
  76. *
  77. * @see template_preprocess()
  78. * @see template_preprocess_page()
  79. */
  80. ?>
  81. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  82. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  83. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
  84. <head>
  85. <?php print $head; ?>
  86. <title><?php print $head_title; ?></title>
  87. <?php print $styles; ?>
  88. <?php print $scripts; ?>
  89. <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyled Content in IE */ ?> </script>
  90. </head>
  91. <body class="<?php print $body_classes; ?>">
  92. <div id="page">
  93. <div id="header">
  94. <div id="logo-title">
  95. <?php if (!empty($logo)): ?>
  96. <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
  97. <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
  98. </a>
  99. <?php endif; ?>
  100. <div id="name-and-slogan">
  101. <?php if (!empty($site_name)): ?>
  102. <h1 id="site-name">
  103. <a href="<?php print $front_page ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
  104. </h1>
  105. <?php endif; ?>
  106. <?php if (!empty($site_slogan)): ?>
  107. <div id="site-slogan"><?php print $site_slogan; ?></div>
  108. <?php endif; ?>
  109. </div> <!-- /name-and-slogan -->
  110. </div> <!-- /logo-title -->
  111. <?php if (!empty($search_box)): ?>
  112. <div id="search-box"><?php print $search_box; ?></div>
  113. <?php endif; ?>
  114. <?php if (!empty($header)): ?>
  115. <div id="header-region">
  116. <?php print $header; ?>
  117. </div>
  118. <?php endif; ?>
  119. </div> <!-- /header -->
  120. <div id="container" class="clear-block">
  121. <div id="navigation" class="menu <?php if (!empty($primary_links)) { print "withprimary"; } if (!empty($secondary_links)) { print " withsecondary"; } ?> ">
  122. <?php if (!empty($primary_links)): ?>
  123. <div id="primary" class="clear-block">
  124. <?php print theme('links', $primary_links, array('class' => 'links primary-links')); ?>
  125. </div>
  126. <?php endif; ?>
  127. <?php if (!empty($secondary_links)): ?>
  128. <div id="secondary" class="clear-block">
  129. <?php print theme('links', $secondary_links, array('class' => 'links secondary-links')); ?>
  130. </div>
  131. <?php endif; ?>
  132. </div> <!-- /navigation -->
  133. <?php if (!empty($left)): ?>
  134. <div id="sidebar-left" class="column sidebar">
  135. <?php print $left; ?>
  136. </div> <!-- /sidebar-left -->
  137. <?php endif; ?>
  138. <div id="main" class="column"><div id="main-squeeze">
  139. <?php if (!empty($breadcrumb)): ?><div id="breadcrumb"><?php print $breadcrumb; ?></div><?php endif; ?>
  140. <?php if (!empty($mission)): ?><div id="mission"><?php print $mission; ?></div><?php endif; ?>
  141. <div id="content">
  142. <?php if (!empty($title)): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
  143. <?php if (!empty($tabs)): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?>
  144. <?php if (!empty($messages)): print $messages; endif; ?>
  145. <?php if (!empty($help)): print $help; endif; ?>
  146. <div id="content-content" class="clear-block">
  147. <?php print $content; ?>
  148. </div> <!-- /content-content -->
  149. <?php print $feed_icons; ?>
  150. </div> <!-- /content -->
  151. </div></div> <!-- /main-squeeze /main -->
  152. <?php if (!empty($right)): ?>
  153. <div id="sidebar-right" class="column sidebar">
  154. <?php print $right; ?>
  155. </div> <!-- /sidebar-right -->
  156. <?php endif; ?>
  157. </div> <!-- /container -->
  158. <div id="footer-wrapper">
  159. <div id="footer">
  160. <?php print $footer_message; ?>
  161. <?php if (!empty($footer)): print $footer; endif; ?>
  162. </div> <!-- /footer -->
  163. </div> <!-- /footer-wrapper -->
  164. <?php print $closure; ?>
  165. </div> <!-- /page -->
  166. </body>
  167. </html>