Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.675 diff -u -p -r1.675 common.inc --- includes/common.inc 29 Jul 2007 17:28:23 -0000 1.675 +++ includes/common.inc 2 Aug 2007 15:04:17 -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 -p -r1.364 theme.inc --- includes/theme.inc 18 Jul 2007 07:05:49 -0000 1.364 +++ includes/theme.inc 2 Aug 2007 15:04:18 -0000 @@ -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 -p -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 15:04:18 -0000 @@ -1,60 +1,180 @@ - - +language contains its textual representation. + * - $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. + * - $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. + * - $is_front: True if the front page is currently being displayed. Used to + * toggle the mission. + * + * Site identity: + * - $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 occurrance in the default page.tpl.php): + * - $sidebar_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. + * + * - $sidebar_right: The HTML for the right sidebar. + * + * 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. + * - $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 template_preprocess_page() + * @see phptemplate_engine_preprocess() + */ +?> + + - <?php print $head_title ?> - - - - + <?php print $head_title; ?> + + + + + +
+ + +
+ + + + + +
+ +
+ +
+

+
+ + +
+ +
+ +
+ +
+ + + + + +
+ + + + + +
- - - - - - - - - - - - - - - - -
-
-
- -

-
- - - - -
-
- - - Index: themes/engines/phptemplate/phptemplate.engine =================================================================== RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v retrieving revision 1.66 diff -u -p -r1.66 phptemplate.engine --- themes/engines/phptemplate/phptemplate.engine 3 Jul 2007 18:48:41 -0000 1.66 +++ themes/engines/phptemplate/phptemplate.engine 2 Aug 2007 15:04:18 -0000 @@ -36,8 +36,9 @@ function phptemplate_theme($existing, $t * The name of the theme function being executed. */ function phptemplate_engine_preprocess(&$variables, $hook) { + global $user; static $count = array(); - + // Create variables so anything which is themed can be zebra striped automatically. $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even'; @@ -46,4 +47,7 @@ function phptemplate_engine_preprocess(& // Tell all templates where they are located. $variables['directory'] = path_to_theme(); $variables['is_front'] = drupal_is_front_page(); + // Tell all templates by which kind of user they're viewed. + $variables['logged_in'] = ($user->uid > 0); + $variables['is_admin'] = user_access('access administration pages'); }