Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.675 diff -u -F^f -r1.675 common.inc --- includes/common.inc 29 Jul 2007 17:28:23 -0000 1.675 +++ includes/common.inc 2 Aug 2007 00:02:33 -0000 @@ -2650,10 +2650,6 @@ function drupal_common_themes() { 'help' => array( 'arguments' => array(), ), - 'node' => array( - 'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE), - 'file' => 'node', - ), 'submenu' => array( 'arguments' => array('links' => NULL), ), Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.364 diff -u -F^f -r1.364 theme.inc --- includes/theme.inc 18 Jul 2007 07:05:49 -0000 1.364 +++ includes/theme.inc 2 Aug 2007 00:02:34 -0000 @@ -225,7 +225,6 @@ function _theme_process_registry(&$cache $function = $name .'_theme'; if (function_exists($function)) { $result = $function($cache, $type, $theme, $path); - foreach ($result as $hook => $info) { $result[$hook]['type'] = $type; $result[$hook]['theme path'] = $path; @@ -1611,6 +1610,7 @@ function template_preprocess_page(&$vari $variables['layout'] = $layout; global $theme; + global $user; // Populate the rest of the regions. $regions = system_region_list($theme); // Load all region content assigned via blocks. @@ -1660,6 +1660,38 @@ function template_preprocess_page(&$vari if ((arg(0) == 'node') && is_numeric(arg(1))) { $variables['node'] = node_load(arg(1)); } + + // 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.). + $body_classes = array(); + // Add a class that tells us whether we're on the front page or not. + $body_classes[] = (drupal_is_front_page()) ? 'front' : 'not-front'; + // Add a class that tells us whether the page is viewed by an authenticated user or not. + $body_classes[] = ($user->uid > 0) ? 'logged-in' : 'not-logged-in'; + // Add arg(0) to make it possible to theme the page depending on the current page + // type (e.g. node, admin, user, etc.). 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). + $body_classes[] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-' . form_clean_id(drupal_strtolower(arg(0)))); + // If on an individual node page, add the node type. + if (isset($variables['node']) && $variables['node']->type) { + $body_classes[] = 'node-type-'. form_clean_id($variables['node']->type); + } + // Add information about the number of sidebars. + if ($variables['sidebar_left'] && $variables['sidebar_right']) { + $body_classes[] = 'two-sidebars sidebar-left sidebar-right'; + } + elseif ($variables['sidebar_left']) { + $body_classes[] = 'one-sidebar sidebar-left'; + } + elseif ($variables['sidebar_right']) { + $body_classes[] = 'one-sidebar sidebar-right'; + } + else { + $body_classes[] = 'no-sidebars'; + } + // Implode with spaces. + $variables['body_classes'] = implode(' ', $body_classes); // Build a list of suggested template files in order of specificity. One // suggestion is made for every element of the current path, though Index: modules/system/page.tpl.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/page.tpl.php,v retrieving revision 1.2 diff -u -F^f -r1.2 page.tpl.php --- modules/system/page.tpl.php 4 May 2007 09:41:36 -0000 1.2 +++ modules/system/page.tpl.php 2 Aug 2007 00:02:34 -0000 @@ -1,60 +1,111 @@ - - + +
-
- - - |
- - 'links', 'id' => 'subnavlist')) ?> - 'links', 'id' => 'navlist')) ?> - - | -
| - | |
| - - | -
-
-
-
-
-
-
-
-
-
-
- |
- - - | -