Posted By

zack on 06/28/11


Tagged

drupal


Versions (?)

Drupal 6 Custom content type page theme


 / Published in: PHP
 

URL: http://at-byte.com/technology/drupal-6-custom-content-type-page-theme

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

Report this snippet  

You need to login to post a comment.