Is there a way to set a template file on the page level in Drupal? Ie. using page-content-type.tpl.php, in addition to page.tpl.php and page-front.tpl.php? I know I can do this on the node level, ie. node-content-type.tpl.php, but when I create a page level template it doesn't seem to have any effect.
We Rock Your Web Forum » Content Management Systems » Drupal
Drupal page template?
(2 posts)-
Posted 1 year ago #
-
Posted 1 year ago
-
Yes, you can. But you'll first need to add the following code snippet to your template.php file:
<?php function themeName_preprocess_page(&$vars, $hook) { if (isset($vars['node'])) { $vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type); } } ?>Posted 1 year ago #