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?
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
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
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
This worked for me!
--
http://www.sitemedia.fi
is it works for Durpal 6.x
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
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