Skip to main content

theming

Drupal 6 Custom content type page theme

If you ever wondered how to change the page.tpl.php for a custom content type you've found out that by default Drupal 6 doesn't know how to do it.

It's "fixed" easily by adding the following code:

  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".

If you need more help on the topic feel free to add a comment or create a new post on the Forum

Syndicate content