Posted By

zeropx on 11/10/10


Tagged

textmate drupal phptemplate tpl preprocess


Versions (?)

preprocess page template tpl files for drupal 6.x


 / Published in: PHP
 

  1. /**
  2.  * Override or insert PHPTemplate variables into the templates.
  3.  */
  4. function phptemplate_preprocess_page(&$vars) {
  5. // Add per content type pages
  6. if (isset($vars['node'])) {
  7. // Add template naming suggestion. It should alway use hyphens.
  8. // If node type is "custom_news", it will pickup "page-custom-news.tpl.php".
  9. $vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type);
  10. }
  11. }

Report this snippet  

You need to login to post a comment.