html.tpl.php

  1. drupal
    1. 7 modules/system/html.tpl.php
    2. 8 core/modules/system/html.tpl.php

Default theme implementation to display the basic html structure of a single Drupal page.

Variables:

  • $css: An array of CSS files for the current page.
  • $language: (object) The language the site is being displayed in. $language->langcode 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 tag.
  • $head_title_array: (array) An associative array containing the string parts that were used to generate the $head_title variable, already prepared to be output as TITLE tag. The key/value pairs may contain one or more of the following, depending on conditions:

    • title: The title of the current page, if any.
    • name: The name of the site.
    • slogan: The slogan of the site, if any, and if there is no title.
  • $head: Markup for the HEAD section (including meta tags, keyword tags, and so on).
  • $default_mobile_metatags: TRUE if default mobile metatags for responsive design should be displayed.
  • $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.
  • $page_top: Initial markup from any modules that have altered the page. This variable should always be output first, before all other dynamic content.
  • $page: The rendered page content.
  • $page_bottom: Final closing markup from any modules that have altered the page. This variable should always be output last, after all other dynamic content.
  • $classes String of classes that can be used to style contextually through CSS.

See also

template_preprocess()

template_preprocess_html()

template_process()

1 theme call to html.tpl.php

File

core/modules/system/html.tpl.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Default theme implementation to display the basic html structure of a single
  5. * Drupal page.
  6. *
  7. * Variables:
  8. * - $css: An array of CSS files for the current page.
  9. * - $language: (object) The language the site is being displayed in.
  10. * $language->langcode contains its textual representation.
  11. * $language->dir contains the language direction.
  12. * It will either be 'ltr' or 'rtl'.
  13. * - $head_title: A modified version of the page title, for use in the TITLE
  14. * tag.
  15. * - $head_title_array: (array) An associative array containing the string parts
  16. * that were used to generate the $head_title variable, already prepared to be
  17. * output as TITLE tag. The key/value pairs may contain one or more of the
  18. * following, depending on conditions:
  19. * - title: The title of the current page, if any.
  20. * - name: The name of the site.
  21. * - slogan: The slogan of the site, if any, and if there is no title.
  22. * - $head: Markup for the HEAD section (including meta tags, keyword tags, and
  23. * so on).
  24. * - $default_mobile_metatags: TRUE if default mobile metatags for responsive
  25. * design should be displayed.
  26. * - $styles: Style tags necessary to import all CSS files for the page.
  27. * - $scripts: Script tags necessary to load the JavaScript files and settings
  28. * for the page.
  29. * - $page_top: Initial markup from any modules that have altered the
  30. * page. This variable should always be output first, before all other dynamic
  31. * content.
  32. * - $page: The rendered page content.
  33. * - $page_bottom: Final closing markup from any modules that have altered the
  34. * page. This variable should always be output last, after all other dynamic
  35. * content.
  36. * - $classes String of classes that can be used to style contextually through
  37. * CSS.
  38. *
  39. * @see template_preprocess()
  40. * @see template_preprocess_html()
  41. * @see template_process()
  42. */
  43. ?><!DOCTYPE html>
  44. <html<?php print $html_attributes; ?>>
  45. <head>
  46. <?php print $head; ?>
  47. <?php if ($default_mobile_metatags): ?>
  48. <meta name="MobileOptimized" content="width" />
  49. <meta name="HandheldFriendly" content="true" />
  50. <meta name="viewport" content="width=device-width" />
  51. <meta http-equiv="cleartype" content="on" />
  52. <?php endif; ?>
  53. <title><?php print $head_title; ?></title>
  54. <?php print $styles; ?>
  55. <?php print $scripts; ?>
  56. </head>
  57. <body class="<?php print $classes; ?>" <?php print $body_attributes;?>>
  58. <div id="skip-link">
  59. <a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to main content'); ?></a>
  60. </div>
  61. <?php print $page_top; ?>
  62. <?php print $page; ?>
  63. <?php print $page_bottom; ?>
  64. </body>
  65. </html>
Login or register to post comments