diff --git a/includes/common.inc b/includes/common.inc index 4373091976ba9e85d818941aefaedf5e1c12c1ca..de85c77a0f7569d25d2efe5395f7190144481500 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4532,6 +4532,10 @@ function drupal_common_theme() { 'placeholder' => array( 'arguments' => array('text' => NULL) ), + 'html' => array( + 'arguments' => array('page' => NULL), + 'template' => 'html', + ), 'page' => array( 'arguments' => array('page' => NULL), 'template' => 'page', diff --git a/includes/theme.inc b/includes/theme.inc index abb0fd757291ec6516567117c8f2e39e76897f92..bb129772320ca9bf0c4c745c4b594edf89ce4085 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2082,6 +2082,86 @@ function template_process(&$variables, $hook) { $variables['title_attributes'] = drupal_attributes($variables['title_attributes_array']); } +/** + * Preprocess variables for html.tpl.php + * + * @see system_elements() + * @see html.tpl.php + */ +function template_preprocess_html(&$variables) { + // Compile a list of classes that are going to be applied to the body element. + // This allows advanced theming based on context (home page, node of certain type, etc.). + // Add a class that tells us whether we're on the front page or not. + $variables['classes_array'][] = $variables['is_front'] ? 'front' : 'not-front'; + // Add a class that tells us whether the page is viewed by an authenticated user or not. + $variables['classes_array'][] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in'; + + // Add information about the number of sidebars. + if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { + $variables['classes_array'][] = 'two-sidebars'; + } + elseif (!empty($variables['page']['sidebar_first'])) { + $variables['classes_array'][] = 'one-sidebar sidebar-first'; + } + elseif (!empty($variables['page']['sidebar_second'])) { + $variables['classes_array'][] = 'one-sidebar sidebar-second'; + } + else { + $variables['classes_array'][] = 'no-sidebars'; + } + + // Populate the body classes. + if ($suggestions = template_page_suggestions(arg(), 'page')) { + foreach ($suggestions as $suggestion) { + if ($suggestion != 'page-front') { + // Add current suggestion to page classes to make it possible to theme the page + // depending on the current page type (e.g. node, admin, user, etc.) as well as + // more specific data like node-12 or node-edit. To avoid illegal characters in + // the class, we're removing everything disallowed. We are not using 'a-z' as + // that might leave in certain international characters (e.g. German umlauts). + $variables['classes_array'][] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', form_clean_id(drupal_strtolower($suggestion))); + } + } + } + + if ($node = menu_get_object()) { + $variables['classes_array'][] = 'node-type-' . form_clean_id($node->type); + } + + // RDFa allows annotation of XHTML pages with RDF data, while GRDDL provides + // mechanisms for extraction of this RDF content via XSLT transformation + // using an associated GRDDL profile. + $variables['rdf_namespaces'] = drupal_get_rdf_namespaces(); + $variables['grddl_profile'] = 'http://ns.inria.fr/grddl/rdfa/'; + $variables['language'] = $GLOBALS['language']; + $variables['language']->dir = $GLOBALS['language']->direction ? 'rtl' : 'ltr'; + + + // Add favicon. + if (theme_get_setting('toggle_favicon')) { + $favicon = theme_get_setting('favicon'); + $type = theme_get_setting('favicon_mimetype'); + drupal_add_html_head('<link rel="shortcut icon" href="' . check_url($favicon) . '" type="' . check_plain($type) . '" />'); + } + + // Construct page title. + if (drupal_get_title()) { + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + } + else { + $head_title = array(variable_get('site_name', 'Drupal')); + if (variable_get('site_slogan', '')) { + $head_title[] = variable_get('site_slogan', ''); + } + } + $variables['head_title'] = implode(' | ', $head_title); + + // Populate the page template suggestions. + if ($suggestions = template_page_suggestions(arg(), 'html')) { + $variables['template_files'] = $suggestions; + } +} + /** * Preprocess variables for page.tpl.php * @@ -2103,33 +2183,21 @@ function template_preprocess_page(&$variables) { // Move some variables to the top level for themer convenience and template cleanliness. $variables['show_messages'] = $variables['page']['#show_messages']; - // Add favicon. - if (theme_get_setting('toggle_favicon')) { - $favicon = theme_get_setting('favicon'); - $type = theme_get_setting('favicon_mimetype'); - drupal_add_html_head('<link rel="shortcut icon" href="' . check_url($favicon) . '" type="' . check_plain($type) . '" />'); - } - // Set up layout variable. $variables['layout'] = 'none'; if (!empty($variables['page']['sidebar_first'])) { $variables['layout'] = 'first'; } + else { + $variables['page']['sidebar_first'] = array(); + } if (!empty($variables['page']['sidebar_second'])) { $variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second'; } - - // Construct page title - if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); - } else { - $head_title = array(variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); - } + $variables['page']['sidebar_second'] = array(); } - $variables['head_title'] = implode(' | ', $head_title); + $variables['base_path'] = base_path(); $variables['front_page'] = url(); $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); @@ -2146,69 +2214,32 @@ function template_preprocess_page(&$variables) { $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin(variable_get('site_slogan', '')) : ''); $variables['tabs'] = theme('menu_local_tasks'); $variables['title'] = drupal_get_title(); - // RDFa allows annotation of XHTML pages with RDF data, while GRDDL provides - // mechanisms for extraction of this RDF content via XSLT transformation - // using an associated GRDDL profile. - $variables['rdf_namespaces'] = drupal_get_rdf_namespaces(); - $variables['grddl_profile'] = 'http://ns.inria.fr/grddl/rdfa/'; if ($node = menu_get_object()) { $variables['node'] = $node; } - // Compile a list of classes that are going to be applied to the body element. - // This allows advanced theming based on context (home page, node of certain type, etc.). - // Add a class that tells us whether we're on the front page or not. - $variables['classes_array'][] = $variables['is_front'] ? 'front' : 'not-front'; - // Add a class that tells us whether the page is viewed by an authenticated user or not. - $variables['classes_array'][] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in'; - // Populate the page template suggestions. - if ($suggestions = template_page_suggestions(arg())) { + if ($suggestions = template_page_suggestions(arg(), 'page')) { $variables['template_files'] = $suggestions; - foreach ($suggestions as $suggestion) { - if ($suggestion != 'page-front') { - // Add current suggestion to page classes to make it possible to theme the page - // depending on the current page type (e.g. node, admin, user, etc.) as well as - // more specific data like node-12 or node-edit. To avoid illegal characters in - // the class, we're removing everything disallowed. We are not using 'a-z' as - // that might leave in certain international characters (e.g. German umlauts). - $variables['classes_array'][] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', form_clean_id(drupal_strtolower($suggestion))); - } - } - } - - // If on an individual node page, add the node type to body classes. - if (isset($variables['node']) && $variables['node']->type) { - $variables['classes_array'][] = 'node-type-' . form_clean_id($variables['node']->type); - } - // Add information about the number of sidebars. - if ($variables['layout'] == 'both') { - $variables['classes_array'][] = 'two-sidebars'; - } - elseif ($variables['layout'] == 'none') { - $variables['classes_array'][] = 'no-sidebars'; - } - else { - $variables['classes_array'][] = 'one-sidebar sidebar-' . $variables['layout']; } } /** - * Process variables for page.tpl.php + * Process variables for html.tpl.php * * Perform final addition and modification of variables before passing into * the template. To customize these variables, call drupal_render() on elements * in $variables['page'] during THEME_preprocess_page(). * - * @see template_preprocess_page() - * @see page.tpl.php + * @see template_preprocess_html() + * @see html.tpl.php */ -function template_process_page(&$variables) { - // Render each region into top level variables. - foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) { - $variables[$region_key] = drupal_render($variables['page'][$region_key]); - } - // Append javascript to $page_bottom +function template_process_html(&$variables) { + // Render page_top and page_bottom into top level variables. + $variables['page_top'] = drupal_render($variables['page']['page_top']); + $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']); + // Place the rendered HTML for the page body into a top level variable. + $variables['page'] = $variables['page']['#children']; $variables['page_bottom'] .= drupal_get_js('footer'); $variables['head'] = drupal_get_html_head(); @@ -2226,7 +2257,7 @@ function template_process_page(&$variables) { * @return * An array of suggested template files. */ -function template_page_suggestions($args) { +function template_page_suggestions($args, $suggestion) { // Build a list of suggested template files and body classes in order of // specificity. One suggestion is made for every element of the current path, @@ -2239,7 +2270,6 @@ function template_page_suggestions($args) { // page-node.tpl.php page-node // page.tpl.php - $suggestion = 'page'; $suggestions = array(); foreach ($args as $arg) { // Remove slashes or null per SA-CORE-2009-003. @@ -2255,7 +2285,7 @@ function template_page_suggestions($args) { } } if (drupal_is_front_page()) { - $suggestions[] = 'page-front'; + $suggestions[] = $suggestion . '-front'; } return $suggestions; diff --git a/modules/block/block.module b/modules/block/block.module index e12b06a66496fe12dbfe20818d1bb4dec9a41d73..69592f41fe2bdd68636f7616b870f313e75dc529 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -197,6 +197,7 @@ function block_page_build(&$page) { // Load all region content assigned via blocks. foreach (array_keys($all_regions) as $region) { + $page[$region] = array(); // Assign blocks to region. if ($blocks = block_get_blocks_by_region($region)) { $page[$region] = $blocks; diff --git a/modules/color/color.module b/modules/color/color.module index fe62dc02deb9dcca8683220446a22eca98f3c5c0..7f470bb5d685658698cd306db8a5712e9341c54c 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -69,7 +69,7 @@ function _color_theme_select_form_alter(&$form, &$form_state) { /** * Callback for the theme to alter the resources used. */ -function _color_page_alter(&$vars) { +function _color_html_alter(&$vars) { global $language, $theme_key; $themes = list_themes(); @@ -93,6 +93,13 @@ function _color_page_alter(&$vars) { $vars['styles'] = drupal_get_css($vars['css']); } +} + +/** + * Callback for the theme to alter the resources used. + */ +function _color_page_alter(&$vars) { + global $language, $theme_key; // Override logo. $logo = variable_get('color_' . $theme_key . '_logo'); diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index 805d855103692a43db3f86578d332d6b6f6c95d8..29fc445c7ac03acd04f161d24f6129bbd565642a 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -26,17 +26,17 @@ class TemplateUnitTest extends DrupalWebTestCase { // test runner fails. variable_set('site_frontpage', 'nobody-home'); $args = array('node', '1', 'edit'); - $suggestions = template_page_suggestions($args); + $suggestions = template_page_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page-node', 'page-node-%', 'page-node-1', 'page-node-edit'), t('Found expected node edit page template suggestions')); // Check attack vectors. $args = array('node', '\\1'); - $suggestions = template_page_suggestions($args); + $suggestions = template_page_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page-node', 'page-node-%', 'page-node-1'), t('Removed invalid \\ from template suggestions')); $args = array('node', '1/'); - $suggestions = template_page_suggestions($args); + $suggestions = template_page_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page-node', 'page-node-%', 'page-node-1'), t('Removed invalid / from template suggestions')); $args = array('node', "1\0"); - $suggestions = template_page_suggestions($args); + $suggestions = template_page_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page-node', 'page-node-%', 'page-node-1'), t('Removed invalid \\0 from template suggestions')); // Tests for drupal_discover_template() $suggestions = array('page'); diff --git a/modules/system/html.tpl.php b/modules/system/html.tpl.php new file mode 100644 index 0000000000000000000000000000000000000000..c84fcbea9ae68623fa9bf7adcb4feb1567d0fbe5 --- /dev/null +++ b/modules/system/html.tpl.php @@ -0,0 +1,52 @@ +<?php +// $Id$ + +/** + * @file + * 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->language contains its textual representation. + * $language->dir contains the language direction. It will either be 'ltr' or 'rtl'. + * - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document. + * - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data. + * - $head_title: A modified version of the page title, for use in the TITLE tag. + * - $head: Markup for the HEAD section (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. + * - $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 template_preprocess() + * @see template_preprocess_html() + * @see template_process() + */ +?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" + "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>" + <?php print $rdf_namespaces; ?>> + +<head profile="<?php print $grddl_profile; ?>"> + <?php print $head; ?> + <title><?php print $head_title; ?></title> + <?php print $styles; ?> + <?php print $scripts; ?> +</head> +<body class="<?php print $classes; ?>" <?php print $attributes;?>> + <?php print $page_top; ?> + <?php print $page; ?> + <?php print $page_bottom; ?> +</body> +</html> diff --git a/modules/system/page.tpl.php b/modules/system/page.tpl.php index a6092204e07871b53b3ecbbb90677b9753a5907f..be4921656a6510f827eb27c4c9715b8b1063fd13 100644 --- a/modules/system/page.tpl.php +++ b/modules/system/page.tpl.php @@ -10,48 +10,12 @@ * 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 template is located in, e.g. modules/system * or themes/garland. - * - $classes_array: Array of html class attribute values. It is flattened - * into a string within the variable $classes. * - $is_front: TRUE if the current page is the front page. Used to toggle the mission statement. * - $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'. - * - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document. - * - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data. - * - $head_title: A modified version of the page title, for use in the TITLE tag. - * - $head: Markup for the HEAD section (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. - * - $classes: String of classes that can be used to style contextually through - * CSS. It should be placed within the <body> tag. When selecting through CSS - * it's recommended that you use the body tag, e.g., "body.front". It can be - * manipulated through the variable $classes_array from preprocess functions. - * The default values can be one or more of the following: - * - page: The current template type, i.e., "theming hook". - * - front: Page is the home page. - * - not-front: Page is not the home page. - * - logged-in: The current viewer is logged in. - * - not-logged-in: The current viewer is not logged in. - * - page-[level 1 path]: The internal first level path. For example, viewing - * example.com/user/2 would result in "page-user". Path aliases do not apply. - * - node-type-[node type]: When viewing a single node, the type of that node. - * For example, if the node is a "Blog entry" it would result in "node-type-blog". - * Note that the machine name will often be in a short form of the human readable label. - * The following only apply with the default 'sidebar_first' and 'sidebar_second' block regions: - * - two-sidebars: When both sidebars have content. - * - no-sidebars: When no sidebar content exists. - * - one-sidebar and sidebar-first or sidebar-second: A combination of the two classes - * when only one of the two sidebars have content. - * * 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. @@ -76,41 +40,22 @@ * - $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). - * - $help: Dynamic help text, mostly for admin pages. - * - $content: The main content of the current page. * - $feed_icons: A string of all feed icons for the current page. - * - $sidebar_first: Items for the first sidebar. - * - $sidebar_second: Items for the second sidebar. - * - $highlight: Items for the highlighted content region. - * - * Opening and closing data: - * - $page_top: Initial markup from any modules that have altered the - * page. This variable should always be output first, before all other dynamic - * content. - * - $footer : The footer region. - * - $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. * + * Regions: + * - $page['help']: Dynamic help text, mostly for admin pages. + * - $page['highlight']: Items for the highlighted content region. + * - $page['content']: The main content of the current page. + * - $page['sidebar_first']: Items for the first sidebar. + * - $page['sidebar_second']: Items for the second sidebar. + * - $page['header']: Items for the header region. + * - $page['footer']: Items for the footer region. + * * @see template_preprocess() * @see template_preprocess_page() * @see template_process() */ ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" - "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>" - <?php print $rdf_namespaces; ?>> - -<head profile="<?php print $grddl_profile; ?>"> - <title><?php print $head_title; ?></title> - <?php print $head; ?> - <?php print $styles; ?> - <?php print $scripts; ?> -</head> -<body class="<?php print $classes; ?>"> - - <?php print $page_top; ?> <div id="page-wrapper"><div id="page"> @@ -146,9 +91,9 @@ <div id="search-box"><?php print $search_box; ?></div> <?php endif; ?> - <?php if ($header): ?> + <?php if ($page['header']): ?> <div id="header-region" class="region"> - <?php print $header; ?> + <?php print render($page['header']); ?> </div> <?php endif; ?> @@ -169,26 +114,26 @@ <div id="main-wrapper"><div id="main" class="clearfix"> <div id="content" class="column"><div class="section"> - <?php if ($highlight): ?><div id="highlight"><?php print $highlight; ?></div><?php endif; ?> + <?php if ($page['highlight']): ?><div id="highlight"><?php print render($page['highlight']); ?></div><?php endif; ?> <?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?> <?php if ($tabs): ?><div class="tabs"><?php print $tabs; ?></div><?php endif; ?> - <?php print $help; ?> + <?php print render($page['help']); ?> <?php if ($action_links): ?><ul class="action-links"><?php print $action_links; ?></ul><?php endif; ?> <div id="content-area" class="region"> - <?php print $content; ?> + <?php print render($page['content']); ?> </div> <!-- /#content-area --> <?php print $feed_icons; ?> </div></div> <!-- /.section, /#content --> - <?php if ($sidebar_first): ?> + <?php if ($page['sidebar_first']): ?> <div id="sidebar-first" class="column sidebar"><div class="section region"> - <?php print $sidebar_first; ?> + <?php print render($page['sidebar_first']); ?> </div></div> <!-- /.section, /#sidebar-first --> <?php endif; ?> - <?php if ($sidebar_second): ?> + <?php if ($page['sidebar_second']): ?> <div id="sidebar-second" class="column sidebar"><div class="section region"> - <?php print $sidebar_second; ?> + <?php print render($page['sidebar_second']); ?> </div></div> <!-- /.section, /#sidebar-second --> <?php endif; ?> @@ -196,12 +141,11 @@ <div id="footer"><div class="section"> <?php print theme('links', $secondary_menu, array('id' => 'secondary-menu', 'class' => array('links', 'clearfix')), t('Secondary menu')); ?> - <?php if ($footer): ?><div id="footer-region" class="region"><?php print $footer; ?></div><?php endif; ?> + <?php if ($page['footer']): ?> + <div id="footer-region" class="region"> + <?php print render($page['footer']); ?> + </div> + <?php endif; ?> </div></div> <!-- /.section, /#footer --> </div></div> <!-- /#page, /#page-wrapper --> - - <?php print $page_bottom; ?> - -</body> -</html> diff --git a/modules/system/system.module b/modules/system/system.module index 4e844bf659848b2cad55811d2de7dea48747893f..5204141c045bb4a3e210a28abc4e94ae023e4350 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -291,6 +291,7 @@ function system_element_info() { $types['page'] = array( '#show_messages' => TRUE, '#theme' => 'page', + '#theme_wrappers' => array('html'), ); $types['list'] = array( '#title' => '', diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index 6b67501ebbac2023120d5d7f5a25b800a93ab716..6b931632a379492a616ca5e6a070edcbb5ac830f 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -46,7 +46,7 @@ function toolbar_page_build(&$page) { * * Add some page classes, so global page theming can adjust to the toolbar. */ -function toolbar_preprocess_page(&$vars) { +function toolbar_preprocess_html(&$vars) { if (user_access('access toolbar')) { $vars['classes_array'][] = 'toolbar toolbar-shortcuts'; } diff --git a/themes/garland/page.tpl.php b/themes/garland/page.tpl.php index acca29d9ba911ba779e5cc0bea6d783649d58d55..5d70f9630b5f83b94b6a6d7cb0130337c7fd615b 100644 --- a/themes/garland/page.tpl.php +++ b/themes/garland/page.tpl.php @@ -1,23 +1,7 @@ <?php // $Id$ -?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" - "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>" - <?php print $rdf_namespaces ?>> - <head profile="<?php print $grddl_profile ?>"> - <title><?php print $head_title ?></title> - <?php print $head ?> - <?php print $styles ?> - <?php print $scripts ?> - <!--[if lt IE 7]> - <?php print $ie_styles ?> - <![endif]--> - </head> - <body class="<?php print $classes ?>"> - - <?php print $page_top; ?> - - <div id="header-region" class="clearfix"><?php print $header ?></div> +?> + <div id="header-region" class="clearfix"><?php print render($page['header']); ?></div> <div id="wrapper"> <div id="container" class="clearfix"> @@ -38,40 +22,36 @@ <?php if ($secondary_nav): print $secondary_nav; endif; ?> </div> <!-- /#header --> - <?php if ($sidebar_first): ?> + <?php if ($page['sidebar_first']): ?> <div id="sidebar-first" class="sidebar"> <?php if ($search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?> - <?php print $sidebar_first ?> + <?php print render($page['sidebar_first']); ?> </div> <?php endif; ?> <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner"> <?php print $breadcrumb; ?> - <?php if ($highlight): ?><div id="highlight"><?php print $highlight ?></div><?php endif; ?> + <?php if ($page['highlight']): ?><div id="highlight"><?php render($page['highlight']); ?></div><?php endif; ?> <?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?> <?php if ($title): ?><h2<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h2><?php endif; ?> <?php if ($tabs): ?><ul class="tabs primary"><?php print $tabs ?></ul></div><?php endif; ?> <?php if ($tabs2): ?><ul class="tabs secondary"><?php print $tabs2 ?></ul><?php endif; ?> <?php if ($show_messages && $messages): print $messages; endif; ?> - <?php print $help; ?> + <?php print render($page['help']); ?> <?php if ($action_links): ?><ul class="action-links"><?php print $action_links; ?></ul><?php endif; ?> <div class="clearfix"> - <?php print $content ?> + <?php print render($page['content']); ?> </div> <?php print $feed_icons ?> - <div id="footer"><?php print $footer ?></div> + <div id="footer"><?php print render($page['footer']) ?></div> </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center --> - <?php if ($sidebar_second): ?> + <?php if ($page['sidebar_second']): ?> <div id="sidebar-second" class="sidebar"> - <?php if (!$sidebar_first && $search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?> - <?php print $sidebar_second ?> + <?php if (!$page['sidebar_first'] && $search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?> + <?php print render($page['sidebar_second']); ?> </div> <?php endif; ?> </div> <!-- /#container --> </div> <!-- /#wrapper --> - - <?php print $page_bottom; ?> - </body> -</html> diff --git a/themes/garland/template.php b/themes/garland/template.php index 70a415ffaf4e71bf01d9eb0e445b98421337d3da..560020315b8e94735f0683cbbeb75490a3a7b677 100644 --- a/themes/garland/template.php +++ b/themes/garland/template.php @@ -19,6 +19,17 @@ function garland_breadcrumb($breadcrumb) { } } +/** + * Override or insert variables into the html template. + */ +function garland_process_html(&$vars) { + // Hook into color.module + if (module_exists('color')) { + _color_html_alter($vars); + } + $vars['styles'] .= "\n<!--[if lt IE 7]>\n" . garland_get_ie_styles() . "<![endif]-->\n"; +} + /** * Override or insert variables into the page template. */ @@ -54,7 +65,6 @@ function garland_preprocess_page(&$vars) { else { $vars['secondary_nav'] = FALSE; } - $vars['ie_styles'] = garland_get_ie_styles(); // Prepare header $site_fields = array(); @@ -73,7 +83,7 @@ function garland_preprocess_page(&$vars) { } /** - * Override process function used to alter variables as late as possible. + * Override or insert variables into the page template. */ function garland_process_page(&$vars) { // Hook into color.module diff --git a/themes/seven/page.tpl.php b/themes/seven/page.tpl.php index e47ccc33413d5e546a46485c43b883d142b4689c..d5d6b7b49d7796bbfacb644df0ca731f43ba115a 100644 --- a/themes/seven/page.tpl.php +++ b/themes/seven/page.tpl.php @@ -1,20 +1,6 @@ <?php // $Id$ -?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" - "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>" - <?php print $rdf_namespaces; ?>> - <head profile="<?php print $grddl_profile; ?>"> - <title><?php print $head_title; ?></title> - <?php print $head; ?> - <?php print $styles; ?> - <?php print $scripts; ?> - <?php print $ie_styles; ?> - </head> - <body class="<?php print $classes; ?>"> - - <?php print $page_top; ?> - +?> <div id="branding" class="clearfix"> <?php print $breadcrumb; ?> <?php if ($title): ?><h1 class="page-title"><?php print $title; ?></h1><?php endif; ?> @@ -28,13 +14,13 @@ <?php if ($show_messages && $messages): ?> <div id="console" class="clearfix"><?php print $messages; ?></div> <?php endif; ?> - <?php if ($help): ?> + <?php if ($page['help']): ?> <div id="help"> - <?php print $help; ?> + <?php print render($page['help']); ?> </div> <?php endif; ?> <?php if ($action_links): ?><ul class="action-links"><?php print $action_links; ?></ul><?php endif; ?> - <?php print $content; ?> + <?php print render($page['content']); ?> </div> <div id="footer"> @@ -42,8 +28,3 @@ </div> </div> - - <?php print $page_bottom; ?> - - </body> -</html> diff --git a/themes/seven/template.php b/themes/seven/template.php index 416de552a57c839657a10e235b139c429f96e1c0..6f40681ff0600dd3618fe0917d72ce9f9bb59243 100644 --- a/themes/seven/template.php +++ b/themes/seven/template.php @@ -4,10 +4,12 @@ /** * Override or insert variables into the page template. */ +function seven_process_html(&$vars) { + $vars['ie_styles'] = '<!--[if lt IE 7]><style type="text/css" media="screen">@import ' . path_to_theme() . '/ie6.css";</style><![endif]-->'; +} function seven_preprocess_page(&$vars) { $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); - $vars['ie_styles'] = '<!--[if lt IE 7]><style type="text/css" media="screen">@import ' . path_to_theme() . '/ie6.css";</style><![endif]-->'; } /**