home forums resources search newsjoinmembers: 6370
Hiveminds Network PHP Flash Java Ruby Windows Linux
 videos
 articles
 blogs
 comments
 downloads
sitemap
Hiveminds | Sat, 2006-06-17 12:21  tags: ,
  1. make a copy of your page.tpl.php file and rename it to be page-default.tpl.php.
  2. make further copies your page.tpl.php file it and rename them to be page-front.tpl.php, page-blog.tpl.php and page-book.tpl.php etcetera..
  3. using a text editor like notepad.exe or equivalent, modify the layout of each tpl.php file to suit your desires
  4. upload your new page-type.tpl.php layout files to your active theme folder
  5. Using a text editor like notepad.exe or equivalent, replace the contents of your page.tpl.php file with the snippet below
  6. Ensure that you have a page-default.tpl.php file as part of your collection of layouts.
  7. Upload your new page.tpl.php file to your active theme folder and your new layouts will take effect automatically

<?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, Drupal 4.6 and Drupal 4.7
*/
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-&gt;type == 'book') {/* check if it's a book page */
    
include 'page-book.tpl.php'/*load a page-book.tpl.php */
    
return; }
if (
$node-&gt;type == 'blog') {/* check if it's a blog node */
    
include 'page-blog.tpl.php'/*load page-blog.tpl.php */
    
return; }
if (
$node-&gt;type == 'image') {/* check if it's an image node */
    
include 'page-image.tpl.php'/*load page-image.tpl.php */
    
return; }
if (
$node-&gt;type == 'forum') {/* check if it's a forum node */
    
include 'page-forum.tpl.php'/*load page-forum.tpl.php */
    
return; }
include 
'page-default.tpl.php'/*if none of the above applies, load the page-default.tpl.php */
    
return;
?>

printer-friendly version

Hiveminds's picture
This article brought to you by the Hiveminds Magazine - Staff. Contact us if you want to post an article or announcement anonymously
 
Web Developers eRuby Adobe Flex Silverlight Drupal Silverlight PHP Adobe Flex
 

Newsletter

Get updates on Hiveminds services, articles and downloads by signing up for the newsletter.

Editor's choice

Some of the better articles, stories and tutorials found at Hiveminds.

Find more

Find more of Hiveminds articles, stories, tutorials and user comments by searching.




Picked links

Hand picked websites and articles from around the web that provide quality reading.

page top