Posted by PierreEG on January 1, 2013 at 6:13pm
Hello,
i try to have full node on my front page using preprocess function.
So this is my code :
<?php
function MYTHEME_preprocess_node(&$variables) {
if ($variables['view_mode'] == 'teaser') {
unset($variables['content']['links']['node']);
}
$variables['view_mode'] = 'full';
}
?>I try to set $variables['view_mode'] with the value full
It doesn't work although it seems this variable exists. I really don't understand where i did a mistake.
Thanks
Pierre
Comments
You can replace the default
You can replace the default front page using a view that displays full nodes. Views comes with a view for the front page you can enable and edit so it shows full nodes.
Changing the view mode in hook_preprocess_node will not have an effect since the contents have already been generated at that point.
Thanks.Using views is a
Thanks.
Using views is a solution, i just was wondering how i could do the same with preprocess function theming.
If i understand, i would have to make changes directly in
template_preprocess_nodeand not inMYTHEME_preprocess_node?hook_preprocess_node() runs
hook_preprocess_node() runs after the data is collected (in this case a view of the node) but before the data is themed. While one could redo the data, views would be more efficient.