Drupal 6 themes: Using $node->type ??
slimandslam - July 7, 2008 - 18:33
In Drupal 5, it was easy to create per-module templates
by using a switch statement in the page.tpl.php file like this:
<?php
if ($is_front) {/* check if it's the front page */
include 'page-front.tpl.php'; /*load a custom front-page.tpl.php */
return; }
if ($node->type == 'contact') {/* check if it's a contact page */
include 'page-contact.tpl.php'; /*load page-contact.tpl.php */
return; }
if ($node->type == 'forums') {/* check if it's a forum page */
include 'page-forum.tpl.php'; /*load page-forum.tpl.php */
return; }
include 'page-default.tpl.php';
return;
?>Under Drupal 6, this sort of works, but not really. :-)
Can someone provide a Drupal 6 version of the code above?
Would it go in the template.tpl.php file, or the page.tpl.php file?
Thanks,
J

See the following documentation...
http://drupal.org/node/173880
http://drupal.org/node/223440
http://drupal.org/node/190815
___________________
It’s in the detaιls…
demonstration portfolio
Thanks. Can you show me one
Thanks. Can you show me one existing theme that replicates
the behaviour I want instead of these pages of documentation
that have almost no examples?
J
I doubt that any contrib
I doubt that any contrib theme will have a separate template for different pages.
All you need to do is note the path of the pages you wish to use a different template, then use the common part to name you template;
page-forum.tpl.php will be used for all pages at yoursite.com/forum
page-front.tpl.php should work ‘out of the box’.
You don’t need to include them any where.
___________________
It’s in the detaιls…
demonstration portfolio
Another thing -- those pages
Another thing -- those pages of documentation don't clearly indicate how to change the top-level wrapper for the module output. I can see how to override the display of the module output, but what I'm trying to do is much simpler -- I just want Drupal to use a specific template for all of a certain module's output e.g. use page-forums.tpl.php as the "container" for all forum output.
J