Index: page.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/clean/page.tpl.php,v
retrieving revision 1.1.2.5.2.8
diff -u -r1.1.2.5.2.8 page.tpl.php
--- page.tpl.php	23 Jun 2009 19:51:52 -0000	1.1.2.5.2.8
+++ page.tpl.php	13 Jul 2009 13:03:50 -0000
@@ -13,7 +13,7 @@
   <!--[if lte IE 6]><link rel="stylesheet" href="<?php print $path ?>css/ie6.css" type="text/css"><![endif]-->
 </head>
 
-<body class="<?php print $body_classes ?>">
+<body id="<?php print $body_id ?>" class="<?php print $body_classes ?>">
   <div id="page">
 
     <div id="header">
Index: template.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/themes/clean/template.php,v
retrieving revision 1.1.2.7.2.8
diff -u -r1.1.2.7.2.8 template.php
--- template.php	19 Jun 2009 11:29:51 -0000	1.1.2.7.2.8
+++ template.php	13 Jul 2009 14:12:28 -0000
@@ -38,6 +38,9 @@
 function phptemplate_preprocess_page(&$vars, $hook) {
   $vars['path'] = base_path() . path_to_theme() .'/';
   $vars['logo'] = preg_replace('@^'. base_path() .'@', '', $vars['logo']);
+
+  // Add body classes.
+  phptemplate_body_classes($vars);
 }
 
 /**
@@ -69,6 +72,47 @@
 }
 
 /**
+ * Create body classes for page templates files in addition to those provided by core.
+ *
+ * @param $vars
+ *   An array of variables to pass to the theme template.
+ * @return
+ *   Adds data to $vars directly.
+ */
+function phptemplate_body_classes(&$vars) {
+  $classes = array();
+
+  // Create classes for the user-visible path sections.
+  // Eg, for the path /section/subsection/page
+  // create: path-section, path-section-subsection, path-section-subsection-page
+  global $base_path;
+  list(,$path) = explode($base_path, $_SERVER['REQUEST_URI'], 2);
+  list($path,) = explode('?', $path, 2);
+  $path = rtrim($path, '/');
+
+  // Create section classes down to 3 levels. Path is empty if we're at <front>.
+  if ($path) {
+    $path_alias_sections = array_slice(explode('/', $path), 0, 3);
+    $section_path   = 'section-path';
+    foreach ($path_alias_sections as $arg_piece) {
+      $section_path .= '-'. $arg_piece;
+      $classes[] = $section_path;
+    }
+  }
+  else {
+    $classes[] = 'section-path-front';
+  }
+
+  $vars['body_classes'] .= ' ' . implode(' ', $classes);
+
+  // System path gives us the id, replacing slashes with dashes.
+  $system_path = drupal_get_normal_path($path);
+  $body_id = str_replace('/', '-', $system_path);
+
+  $vars['body_id'] = 'page-'. $body_id;
+}
+
+/**
  * Override or insert variables into the comment templates.
  *
  * @param $vars
