page.tpl.php

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

Bartik's theme implementation to display a single Drupal page.

The doctype, html, head, and body tags are not in this template. Instead they can be found in the html.tpl.php template normally located in the core/modules/system directory.

Available variables:

General utility variables:

  • $base_path: The base URL path of the Drupal installation. At the very least, this will always default to /.
  • $directory: The directory the template is located in, e.g. modules/system or themes/bartik.
  • $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.

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.
  • $hide_site_name: TRUE if the site name has been toggled off on the theme settings page. If hidden, the "element-invisible" class is added to make the site name visually hidden, but still accessible.
  • $hide_site_slogan: TRUE if the site slogan has been toggled off on the theme settings page. If hidden, the "element-invisible" class is added to make the site slogan visually hidden, but still accessible.

Navigation:

  • $main_menu (array): An array containing the Main menu links for the site, if they have been configured.
  • $secondary_menu (array): An array containing the Secondary menu links for the site, if they have been configured.
  • $breadcrumb: The breadcrumb trail for the current page.

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

  • $title_prefix (array): 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: The page title, for use in the actual HTML content.
  • $title_suffix (array): An array containing additional output populated by modules, intended to be displayed after the main title tag that appears in the template.
  • $messages: HTML for status and error messages. Should be displayed prominently.
  • $tabs (array): Tabs linking to any sub-pages beneath the current page (e.g., the view and edit tabs when displaying a node).
  • $action_links (array): Actions local to the page, such as 'Add menu' on the menu administration interface.
  • $feed_icons: A string of all feed icons for the current page.
  • $node: The node entity, 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).

Regions:

  • $page['header']: Items for the header region.
  • $page['featured']: Items for the featured region.
  • $page['highlighted']: Items for the highlighted content region.
  • $page['help']: Dynamic help text, mostly for admin pages.
  • $page['content']: The main content of the current page.
  • $page['sidebar_first']: Items for the first sidebar.
  • $page['triptych_first']: Items for the first triptych.
  • $page['triptych_middle']: Items for the middle triptych.
  • $page['triptych_last']: Items for the last triptych.
  • $page['footer_firstcolumn']: Items for the first footer column.
  • $page['footer_secondcolumn']: Items for the second footer column.
  • $page['footer_thirdcolumn']: Items for the third footer column.
  • $page['footer_fourthcolumn']: Items for the fourth footer column.
  • $page['footer']: Items for the footer region.

See also

template_preprocess()

template_preprocess_page()

template_process()

bartik_process_page()

html.tpl.php

File

core/themes/bartik/templates/page.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Bartik's theme implementation to display a single Drupal page.
  5. *
  6. * The doctype, html, head, and body tags are not in this template. Instead
  7. * they can be found in the html.tpl.php template normally located in the
  8. * core/modules/system directory.
  9. *
  10. * Available variables:
  11. *
  12. * General utility variables:
  13. * - $base_path: The base URL path of the Drupal installation. At the very
  14. * least, this will always default to /.
  15. * - $directory: The directory the template is located in, e.g. modules/system
  16. * or themes/bartik.
  17. * - $is_front: TRUE if the current page is the front page.
  18. * - $logged_in: TRUE if the user is registered and signed in.
  19. * - $is_admin: TRUE if the user has permission to access administration pages.
  20. *
  21. * Site identity:
  22. * - $front_page: The URL of the front page. Use this instead of $base_path,
  23. * when linking to the front page. This includes the language domain or
  24. * prefix.
  25. * - $logo: The path to the logo image, as defined in theme configuration.
  26. * - $site_name: The name of the site, empty when display has been disabled
  27. * in theme settings.
  28. * - $site_slogan: The slogan of the site, empty when display has been disabled
  29. * in theme settings.
  30. * - $hide_site_name: TRUE if the site name has been toggled off on the theme
  31. * settings page. If hidden, the "element-invisible" class is added to make
  32. * the site name visually hidden, but still accessible.
  33. * - $hide_site_slogan: TRUE if the site slogan has been toggled off on the
  34. * theme settings page. If hidden, the "element-invisible" class is added to
  35. * make the site slogan visually hidden, but still accessible.
  36. *
  37. * Navigation:
  38. * - $main_menu (array): An array containing the Main menu links for the
  39. * site, if they have been configured.
  40. * - $secondary_menu (array): An array containing the Secondary menu links for
  41. * the site, if they have been configured.
  42. * - $breadcrumb: The breadcrumb trail for the current page.
  43. *
  44. * Page content (in order of occurrence in the default page.tpl.php):
  45. * - $title_prefix (array): An array containing additional output populated by
  46. * modules, intended to be displayed in front of the main title tag that
  47. * appears in the template.
  48. * - $title: The page title, for use in the actual HTML content.
  49. * - $title_suffix (array): An array containing additional output populated by
  50. * modules, intended to be displayed after the main title tag that appears in
  51. * the template.
  52. * - $messages: HTML for status and error messages. Should be displayed
  53. * prominently.
  54. * - $tabs (array): Tabs linking to any sub-pages beneath the current page
  55. * (e.g., the view and edit tabs when displaying a node).
  56. * - $action_links (array): Actions local to the page, such as 'Add menu' on
  57. * the menu administration interface.
  58. * - $feed_icons: A string of all feed icons for the current page.
  59. * - $node: The node entity, if there is an automatically-loaded node
  60. * associated with the page, and the node ID is the second argument
  61. * in the page's path (e.g. node/12345 and node/12345/revisions, but not
  62. * comment/reply/12345).
  63. *
  64. * Regions:
  65. * - $page['header']: Items for the header region.
  66. * - $page['featured']: Items for the featured region.
  67. * - $page['highlighted']: Items for the highlighted content region.
  68. * - $page['help']: Dynamic help text, mostly for admin pages.
  69. * - $page['content']: The main content of the current page.
  70. * - $page['sidebar_first']: Items for the first sidebar.
  71. * - $page['triptych_first']: Items for the first triptych.
  72. * - $page['triptych_middle']: Items for the middle triptych.
  73. * - $page['triptych_last']: Items for the last triptych.
  74. * - $page['footer_firstcolumn']: Items for the first footer column.
  75. * - $page['footer_secondcolumn']: Items for the second footer column.
  76. * - $page['footer_thirdcolumn']: Items for the third footer column.
  77. * - $page['footer_fourthcolumn']: Items for the fourth footer column.
  78. * - $page['footer']: Items for the footer region.
  79. *
  80. * @see template_preprocess()
  81. * @see template_preprocess_page()
  82. * @see template_process()
  83. * @see bartik_process_page()
  84. * @see html.tpl.php
  85. *
  86. * @ingroup themeable
  87. */
  88. ?>
  89. <div id="page-wrapper"><div id="page">
  90. <div id="header" class="<?php print $secondary_menu ? 'with-secondary-menu': 'without-secondary-menu'; ?>"><div class="section clearfix">
  91. <?php if ($logo): ?>
  92. <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
  93. <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
  94. </a>
  95. <?php endif; ?>
  96. <?php if ($site_name || $site_slogan): ?>
  97. <div id="name-and-slogan"<?php if ($hide_site_name && $hide_site_slogan) { print ' class="element-invisible"'; } ?>>
  98. <?php if ($site_name): ?>
  99. <?php if ($title): ?>
  100. <div id="site-name"<?php if ($hide_site_name) { print ' class="element-invisible"'; } ?>>
  101. <strong>
  102. <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
  103. </strong>
  104. </div>
  105. <?php else: /* Use h1 when the content title is empty */ ?>
  106. <h1 id="site-name"<?php if ($hide_site_name) { print ' class="element-invisible"'; } ?>>
  107. <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
  108. </h1>
  109. <?php endif; ?>
  110. <?php endif; ?>
  111. <?php if ($site_slogan): ?>
  112. <div id="site-slogan"<?php if ($hide_site_slogan) { print ' class="element-invisible"'; } ?>>
  113. <?php print $site_slogan; ?>
  114. </div>
  115. <?php endif; ?>
  116. </div> <!-- /#name-and-slogan -->
  117. <?php endif; ?>
  118. <?php print render($page['header']); ?>
  119. <?php if ($main_menu): ?>
  120. <div id="main-menu" class="navigation">
  121. <?php print theme('links__system_main_menu', array(
  122. 'links' => $main_menu,
  123. 'attributes' => array(
  124. 'id' => 'main-menu-links',
  125. 'class' => array('links', 'clearfix'),
  126. ),
  127. 'heading' => array(
  128. 'text' => t('Main menu'),
  129. 'level' => 'h2',
  130. 'class' => array('element-invisible'),
  131. ),
  132. )); ?>
  133. </div> <!-- /#main-menu -->
  134. <?php endif; ?>
  135. <?php if ($secondary_menu): ?>
  136. <div id="secondary-menu" class="navigation">
  137. <?php print theme('links__system_secondary_menu', array(
  138. 'links' => $secondary_menu,
  139. 'attributes' => array(
  140. 'id' => 'secondary-menu-links',
  141. 'class' => array('links', 'inline', 'clearfix'),
  142. ),
  143. 'heading' => array(
  144. 'text' => t('Secondary menu'),
  145. 'level' => 'h2',
  146. 'class' => array('element-invisible'),
  147. ),
  148. )); ?>
  149. </div> <!-- /#secondary-menu -->
  150. <?php endif; ?>
  151. </div></div> <!-- /.section, /#header -->
  152. <?php if ($messages): ?>
  153. <div id="messages"><div class="section clearfix">
  154. <?php print $messages; ?>
  155. </div></div> <!-- /.section, /#messages -->
  156. <?php endif; ?>
  157. <?php if ($page['featured']): ?>
  158. <div id="featured"><div class="section clearfix">
  159. <?php print render($page['featured']); ?>
  160. </div></div> <!-- /.section, /#featured -->
  161. <?php endif; ?>
  162. <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">
  163. <?php print $breadcrumb; ?>
  164. <?php if ($page['sidebar_first']): ?>
  165. <div id="sidebar-first" class="column sidebar"><div class="section">
  166. <?php print render($page['sidebar_first']); ?>
  167. </div></div> <!-- /.section, /#sidebar-first -->
  168. <?php endif; ?>
  169. <div id="content" class="column"><div class="section">
  170. <?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
  171. <a id="main-content"></a>
  172. <?php print render($title_prefix); ?>
  173. <?php if ($title): ?>
  174. <h1 class="title" id="page-title">
  175. <?php print $title; ?>
  176. </h1>
  177. <?php endif; ?>
  178. <?php print render($title_suffix); ?>
  179. <?php if ($tabs): ?>
  180. <div class="tabs">
  181. <?php print render($tabs); ?>
  182. </div>
  183. <?php endif; ?>
  184. <?php print render($page['help']); ?>
  185. <?php if ($action_links): ?>
  186. <ul class="action-links">
  187. <?php print render($action_links); ?>
  188. </ul>
  189. <?php endif; ?>
  190. <?php print render($page['content']); ?>
  191. <?php print $feed_icons; ?>
  192. </div></div> <!-- /.section, /#content -->
  193. <?php if ($page['sidebar_second']): ?>
  194. <div id="sidebar-second" class="column sidebar"><div class="section">
  195. <?php print render($page['sidebar_second']); ?>
  196. </div></div> <!-- /.section, /#sidebar-second -->
  197. <?php endif; ?>
  198. </div></div> <!-- /#main, /#main-wrapper -->
  199. <?php if ($page['triptych_first'] || $page['triptych_middle'] || $page['triptych_last']): ?>
  200. <div id="triptych-wrapper"><div id="triptych" class="clearfix">
  201. <?php print render($page['triptych_first']); ?>
  202. <?php print render($page['triptych_middle']); ?>
  203. <?php print render($page['triptych_last']); ?>
  204. </div></div> <!-- /#triptych, /#triptych-wrapper -->
  205. <?php endif; ?>
  206. <div id="footer-wrapper"><div class="section">
  207. <?php if ($page['footer_firstcolumn'] || $page['footer_secondcolumn'] || $page['footer_thirdcolumn'] || $page['footer_fourthcolumn']): ?>
  208. <div id="footer-columns" class="clearfix">
  209. <?php print render($page['footer_firstcolumn']); ?>
  210. <?php print render($page['footer_secondcolumn']); ?>
  211. <?php print render($page['footer_thirdcolumn']); ?>
  212. <?php print render($page['footer_fourthcolumn']); ?>
  213. </div> <!-- /#footer-columns -->
  214. <?php endif; ?>
  215. <?php if ($page['footer']): ?>
  216. <div id="footer" class="clearfix">
  217. <?php print render($page['footer']); ?>
  218. </div> <!-- /#footer -->
  219. <?php endif; ?>
  220. </div></div> <!-- /.section, /#footer-wrapper -->
  221. </div></div> <!-- /#page, /#page-wrapper -->

Related topics

Login or register to post comments