Best way to switch page.tpl.php based on node type?

dougstum - July 24, 2007 - 04:13

I need to switch from three column to two column layout based on node type (e.g., when I display a node of type foo I want to switch layout.) Should I do this directly in page.tpl.php?

Thanks!

Read this

gopher - July 24, 2007 - 05:02

If you only want to

patrickharris - July 24, 2007 - 08:09

If you only want to 'turn a column off', it might be easier to just do an if then statement around the column in question in your page template.

Just for the record, in Drupal 5, as well as node-$type.tpl.php, you can also associate a new page template with a url. As the Pro Drupal Development book points out, the url 'http:/example.com/?q=node/1/edit' will map to

page-node-edit.tpl.php
page-node-1.tpl.php
page-node.tpl.php
page.tpl.php

To create a custom template for the front page, use page-front.tpl.php.

 
 

Drupal is a registered trademark of Dries Buytaert.