function bartik_process_page(&$variables) {
$variables['theme_hook_suggestions'][] = 'page__product';
.....
}

above, I can suggestion page--product.tpl.php
but it is static.

if product is a content type name, then how to suggestion it dynamatic?

I can not get the node type in function bartik_process_page(&$variables) .

Comments

arrakis83’s picture

Jaypan’s picture

You do not need to add template suggestions for content types, system already provides them. So if you have a content type named product, you can implement page--product.tpl.php and if you have a content type name ninja you can implement page--ninja.tpl.php without having to implement any template suggestions.

jasonzh’s picture

thanks, arrakis83
hi,Jaypan , from https://drupal.org/node/1089656 ,in drupal 7 , node--type.tpl.php is ok,but page--type.tpl.php not support

drupal ,the sharp skill to eastablish website.

rajeevk’s picture

This will work :

<?php
function THEMENAME_preprocess_page(&$vars) {
    if (isset($vars['node']->type)) {
        $vars['theme_hook_suggestions'][]='page__'.$vars['node']->type;
    }
}
?>

Rajeev Kumar,
@drupler@bihar.social (ActivityPub)

jasonzh’s picture

Great ,thanks!

drupal ,the sharp skill to eastablish website.