By jkestler on
I need to combine the following two theme override functions, but I'm not sure how to do so (I'm new to PHP). Any help is much appreciated.
Note that I'm using a subtheme in Zen, so my functions are mysubtheme_preprocess_ rather than _phptemplate_variables.
Thanks!
Function 1
//let HTML page title differ from node title using page_title module
function mysubtheme_preprocess_page($hook, $vars) {
$vars = array();
if ($hook == 'page') {
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title();
}
}
return $vars;
}
Function 2
// use different page template suggestions based on node type
function mysubtheme_preprocess_page(&$vars) {
if ($vars['node']) {
$suggestions[] = 'page-nodetype-'. $vars['node']->type;
// check to see if we're on the edit page
$path = explode('/', $_GET['q']);
if (!(arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit')) {
$vars['template_files'] = $suggestions;
}
}
return $vars;
}
Comments
This may help, I am guessing
This may help, I am guessing this is a Drupal 6 (not 5) theme in which case this may help
Thanks!
That did the trick. I'm actually using a Zen subtheme in D5, hence 'preprocess_page' instead of '_phptemplate_variables for theme override functions.