Different node.tpl.php in front page

wpanssi - August 21, 2008 - 14:35

How can I theme nodes in the front page differently, that is to use different node.tpl.php with nodes displayed in the front page?

This might not the be the

vsnguyen - August 21, 2008 - 15:02

This might not the be the best way to go about it, but I use the is_front() function to theme the node the for front page.

In your theme's

yuriy.babenko - August 21, 2008 - 15:36

In your theme's template.php, add:

<?php
   
function _phptemplate_variables($hook, $vars = array())
    {
        switch (
$hook)
        {
            case
'node':
           
                if(
drupal_is_front_page())
                {
                   
$vars['template_files'][] = 'node-front';
                }
           
            break;
        }
    }
?>

This will look for node-front.tpl.php before defaulting to node.tpl.php.

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

This worked for

wpanssi - August 21, 2008 - 18:11

This worked for me!

--
http://www.sitemedia.fi

is it works for Durpal 6.x

klezer - December 22, 2008 - 14:20

is it works for Durpal 6.x ?

    function _phptemplate_variables($hook, $vars = array())
    {
        switch ($hook)
        {
            case 'node':
          
                if(drupal_is_front_page())
                {
                    $vars['template_files'][] = 'node-front';
                }
          
            break;
        }
    }

No, the code snippet I

yuriy.babenko - January 6, 2009 - 21:05

No, the code snippet I posted is for Drupal 5.

Take a look at this: http://www.yubastudios.com/blog/drupal-extending-templating
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

 
 

Drupal is a registered trademark of Dries Buytaert.