Theming node by content type in Drupal 7

217 views Asked by At

I am building a drupal theme from scratch and I encountered a problem - when trying to theme a node by content type <?php print render($content); ?> gives me nothing. My template.php file:

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

Thanks in advance :)

1

There are 1 answers

2
p.tamas On

In your tpl file, where you want to render($content) you have to put near first lines:

hook_preprocess_page();

Hope this helps.