仅在面包屑中显示一些导航页面,而不是在zf2的顶层菜单中

时间:2014-06-13 18:17:44

标签: menu navigation zend-framework2 breadcrumbs

我有导航并将其用于面包屑。我也希望将它用于顶级菜单,但我不想在顶级菜单中显示我的产品。 我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:0)

在module.config.php中定义数组时添加自定义属性 -

例如:

array(
    'label' => 'Product List',
    'route' => 'product',
    'action' => 'index',
    'resource' => 'Product\Controller\Product:index',
    'top_menu' => '0',
),

对于其余数组,将top_menu属性设置为1

在顶级菜单的部分文件中,选中 -

<?php foreach ($this->container as $page) {
    [...]

    if($page->get('top_menu') == '1') {
        //Code to display the menu.
    }

    [...]    
} ?>

我希望它能给出一些想法。

相关问题