By Andrew Thomas on
im using this snippet but its not working for me maybe im doing something wrong.
do i replace my entire page.tpl.php code with this one or do i add it to the top of the already existing code?
and secondly, how does this know if its my front page because my front page is just www.examplesite.com/ and not www.examplesite.com/front-page
/**
* 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->type == 'book') {/* check if it's a book page */
include 'page-book.tpl.php'; /*load a page-book.tpl.php */
return; }
if ($node->type == 'blog') {/* check if it's a blog node */
include 'page-blog.tpl.php'; /*load page-blog.tpl.php */
return; }
if ($node->type == 'image') {/* check if it's an image node */
include 'page-image.tpl.php'; /*load page-image.tpl.php */
return; }
if ($node->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;
Comments
I'm not sure but maybe you
I'm not sure
but maybe you have to use php's exit function to break the code, after loading the custom page file
you use return here .. maybe there is a difference between the two