Hello,
I'm trying to customize my theme frontpage, using the hook "page--front.tpl.php"

The hook is working, but I can't have the primary nav displayed on it.

On classic pages, the primary nav (=main-menu) is shown properly using the following code :

<?php if (!empty($primary_nav)): ?>
    <?php print render($primary_nav); ?>
<?php endif; ?>

<?php if (!empty($secondary_nav)): ?>
    <?php print render($secondary_nav); ?>
<?php endif; ?>

<?php if (!empty($page['navigation'])): ?>
    <?php print render($page['navigation']); ?>
<?php endif; ?>

On page--front.tpl.php, menu is not displayed.
$primary_nav returns "FALSE" and $main_menu is null until they are correctly filled in classic page.tpl.php

Any ideas about this problem ?
Thanks

Comments

benjhoo created an issue. See original summary.

markhalliwell’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)
Issue tags: -Front page, -frontpage, -navigation, -main-menu

Did you clear the caches so the theme registry could be rebuilt?

benjhoo’s picture

Yes all caches are cleared from the admin "performance" page.

My page--front.tpl.php appears correctly. Just the vars $primary_nav or $main_menu which are not filled.

Also, in functions MYSUBTHEME_preprocess_html or MYSUBTHEME_preprocess_page in template.php, index "main_menu" does not exist in $variables array.

Thank you

benjhoo’s picture

Issue summary: View changes
benjhoo’s picture

Issue summary: View changes
benjhoo’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I found the solution.
It was my bad... :(

'Default Homepage' in admin > Config > Informations was pointing to a non-existent node content...

Clearing the field and letting it empty resolves my problem.
I have now my main menu in my page--front template.

Sorry for this inconvenience and thank you