Drupal 6 Custom content type page theme


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.