/ Published in: PHP
Expand |
Embed | Plain Text
<?php /** * This snippet loads up different page-type.tpl.php layout * files automatically. For use in a page.tpl.php file. * * This works with Drupal 4.5, 4.6, 4.7, 5, 6 */ //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 == 'home_page') { include 'page-home_page.tpl.php'; return; } if ($node->type == 'web_page') { include 'page-web_page.tpl.php'; return; } include 'page-default.tpl.php'; /*if none of the above applies, load the page-default.tpl.php */ return; ?>
Comments
Subscribe to comments
You need to login to post a comment.

This allows you to pull a different template page based on your node types. So in my theme folder I would have the following files.
node.tpl.php page.tpl.php -> this snippet page-homepage.tpl.php page-webpage.tpl.php and page-default.tpl.php
This is a pretty quick and easy way to theme different node types as well as for the home page.
Thanks ;)
thanks