Return to Snippet

Revision: 55779
at February 22, 2012 08:07 by mktimes5


Initial Code
function themeName_preprocess_page(&$variables, $hook) {
    // 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__type__'. str_replace('_', '--', $variables['node']->type);   
    }
}

Initial URL
http://cheekymonkeymedia.ca/blog/brian-top-chimp/how-have-drupal-7-node-type-page-tpls

Initial Description
Add this snippet to template.php

Initial Title
Node Type Page TPLs

Initial Tags
drupal

Initial Language
PHP