summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnAlbin2008-01-20 07:25:51 (GMT)
committer JohnAlbin2008-01-20 07:25:51 (GMT)
commit9faf4798ad2b4d5427c4cc804e0fa35c497016ec (patch)
tree9f4d2649d79a3b022c1dbd9c2d6b676a559ce78c
parente0a8f49481025b906ef82bad23a726b98aaa7751 (diff)
Simplified creation of page- and section- body classes.
-rw-r--r--template.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/template.php b/template.php
index e3d77b5..e31ab09 100644
--- a/template.php
+++ b/template.php
@@ -154,19 +154,9 @@ function phptemplate_preprocess_page(&$vars) {
$body_classes = array($vars['body_classes']);
if (!$vars['is_front']) {
// Add unique classes for each page and website section
- // First, remove base path and any query string.
- global $base_path;
- list(,$path) = explode($base_path, $_SERVER['REQUEST_URI'], 2);
- // If clean URLs are off, strip remainder of query string.
- list($path,) = explode('&', $path, 2);
- // Strip query string.
- list($path,) = explode('?', $path, 2);
- $path = rtrim($path, '/');
- // Construct the id name from the path, replacing slashes with dashes.
- $full_path = str_replace('/', '-', $path);
- // Construct the class name from the first part of the path only.
+ $path = drupal_get_path_alias($_GET['q']);
list($section,) = explode('/', $path, 2);
- $body_classes[] = zen_id_safe('page-'. $full_path);
+ $body_classes[] = zen_id_safe('page-'. $path);
$body_classes[] = zen_id_safe('section-'. $section);
}
$vars['body_classes'] = implode(' ', $body_classes); // implode with spaces