Hello, I creat a new content type call realisation. I create a diferent layout for page--realisation.tpl.php but notihing happen. I clear cache.
I try also to put the function to override custom page in template.php "function clean_preprocess_page(&$variables) {..."
but the next error appear "Cannot redeclare clean_preprocess_page() (previously declared in .....sites\all\themes\clean\includes\clean.preprocess.inc on line 111

Can somebody help me
Thanks

Comments

JPE’s picture

Hi, I found this and it works but an error appear

Notice : Undefined index: node dans clean_process_page() (ligne 100 dans ...sites\all\themes\clean\template.php).
Notice : Trying to get property of non-object dans clean_process_page() (ligne 100 dans ....sites\all\themes\clean\template.php).

function clean_process_page(&$variables) {
    $variables['theme_hook_suggestions'][] = 'page__'. $variables['node']->type;
}
JPE’s picture

Ok this works for me. I think it was the name of the function.

function clean_process_page(&$variables) {
    // When this goes through the theme.inc some where it changes _ to - so the tpl name is actually page--type-typename.tpl
    if (isset($variables['node'])) {
        $variables['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $variables['node']->type);   
    }
}
JPE’s picture

Ok this works for me. I think it was the name of the function.

function clean_process_page(&$variables) {
    // When this goes through the theme.inc some where it changes _ to - so the tpl name is actually page--type-typename.tpl
    if (isset($variables['node'])) {
        $variables['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $variables['node']->type);   
    }
}
psynaptic’s picture

Status: Active » Fixed

You shouldn't really add suggestions in process. That is for last minute things like converting attributes_array to a string for printing in the template file etc.

Anyway, seems you have sorted your issue so closing this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.