Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I am having a few problems overriding the front page template.
So create a template called page--front.tpl.php in my sub theme template directory. That didn't work.
So I added a theme_hook_suggestions in my mytheme_preprocess_html() as shown:
if($variables['is_front']){
array_unshift($variables['theme_hook_suggestions'], 'page__front');
}
So that worked but I can't seem to use the render function: -
print render($page['header']);
the error I get is: -
Fatal error: Only variables can be passed by reference.
But it allows me to: -
print $page;
Any Ideas?
Thanks in Advance
Comments
Comment #1
fubhy CreditAttribution: fubhy commentedThat sounds like you are using a layout? Layouts are not page.tpl.php (and, thus, do not support page--front.tpl.php)... When you added that theme hook suggestion you basically just added it manually even though it was never going to go to page.tpl.php anyways... Disable the layout extension if you want to do this with plain page.tpl.php (which is fine) or, if you want to keep using layouts, switch the layout for the front page using hook_omega_layout_alter() or the context_omega module.