Front page layout switcher for your page.tpl.php file

Last modified: August 23, 2009 - 22:26

description

This snippet automatically switches your theme to a custom page-front.tpl.php for the front page of your Drupal site.

It's an alternative method of customising your front page to using the front_page.module.

usage

  1. Make a copy of your page.tpl.php file and rename it to page-front.tpl.php.
  2. Using a text editor like notepad.exe or equivalent, copy the snippet and place it at the very top of your page.tpl.php file.
  3. Edit your page-front.tpl.php layout file
  4. Upload your new page-front.tpl.php layout file and your edited page.tpl.php file to your active theme folder

<?php

/**
* This snippet tells Drupal to load up a different page-front.tpl.php layout
* file 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) {
  include(
'page-front.tpl.php');
  return;
}

/**
* This snippet MUST go at the very top of your page.tpl.php file.
* the rest of your page.tpl.php in entirety should follow this snippet.
*/
?>

notes

 
 

Drupal is a registered trademark of Dries Buytaert.