/**
* Override or insert PHPTemplate variables into the templates.
*/
function phptemplate_preprocess_page(&$vars) {
// Add unique classes for each page and website section
$path = drupal_get_path_alias($_GET['q']);
// append the body classes array with the current path
$body_classes[] = phptemplate_format_class('page-' . $path);
// set body_classes var with spaces in between each class
$vars['body_classes'] = implode(' ', $body_classes);
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
if ( $alias != $_GET['q'] && $alias == $_REQUEST['q'] ) {
$suggestions = array();
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$suggestions[] = $template_filename;
}
}
$vars['template_files'] = $suggestions;
}
}
//Helper Function for formatting css class names
function phptemplate_format_class($string) {
return strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
}