By wpanssi on
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?
Comments
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:
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
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
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 ?
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
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
This tutorial does not seem
This tutorial does not seem to specify how to do a custom node template for the 'front' page. How do we use this method to use a different node template file for the 'front' page?
theme_preprocess_node
You can move this block into theme_preprocess_node() into template.php
and make sure that you have cleared cached each time before front page refreshment.
Try exit() to make sure that it's loaded for sure.
Drupal 6.x
Edit /sites/all/themes/YOURTHEME/template.php to include:
Then copy /modules/node/node.tpl.php to /sites/all/themes/YOURTHEME/node-front.tpl.php and customize it to your needs.
Page templates and node templates
This is an impressive helper function as it can be used for both page templates and node templates:
THEME_preprocess_pageTemplate_file(s)contains possible "page" templatesTHEME_preprocess_nodeTemplate_file(s)refers to node templates.You can apply this trick in
You can apply this trick in pretty much any preprocessing function for any piece of themed content. I've got an example for blocks, too.
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
Thanks for this snippet
Thanks for this snippet NoCoolNamesRemain.
Anyone would be kind enough to make it Drupal 7 ready?
Sorry for bumping up and old post, but google search rated this up high so future drupalistas might stumble upon this as well.
Regards
---
no signature is a good signature