Вот дополнительная информация о комментарии template.php:
В page.tpl.php добавьте
<body class="<?php print $body_classes; ?>">
в template.php, добавьте
function phptemplate_preprocess_page(&$vars, $hook) {
// Classes for body element. Allows advanced theming based on context
// (home page, node of certain type, etc.)
$body_classes = array($vars['body_classes']);
if (!$vars['is_front']) {
// Add unique classes for each page and website section
$path = drupal_get_path_alias($_GET['q']);
list($section, ) = explode('/', $path, 2);
$body_classes[] = phptemplate_id_safe('page-' . $path);
$body_classes[] = phptemplate_id_safe('section-' . $section);
if (arg(0) == 'node') {
if (arg(1) == 'add') {
if ($section == 'node') {
array_pop($body_classes); // Remove 'section-node'
}
$body_classes[] = 'node-add'; // Add 'node-add'
}
elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) {
if ($section == 'node') {
array_pop($body_classes); // Remove 'section-node'
}
$body_classes[] = 'node-' . arg(2); // Add 'node-edit' or 'node-delete'
}
}
}
$vars['body_classes'] = implode(' ', $body_classes); // Concatenate with spaces
}
function phptemplate_id_safe($string) {
if (is_numeric($string{0})) {
// If the first character is numeric, add 'n' in front
$string = 'n'. $string;
}
return strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
}