Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:28:37+00:00 2026-06-13T07:28:37+00:00

I am trying to use a main navigation in combination with a submenu for

  • 0

I am trying to use a main navigation in combination with a submenu for more specific navigating.

In my layout I am calling the view helper like this:

$this->navigation('main_navigation')->menu()

and in my view I am calling it like this:

$this->navigation('sub_navigation')->menu()

The problem is that whenever I call the navigation() view helper a more than once, it just outputs the second one in both places. In other words, it’s printing the subnav for both the main nav and the subnav menus.

My merged config looks like this:

'navigation' => array(
    'main' => array(
        'home' => array(
            'label' => 'Home',
            'route' => 'myroute',
        ),
        'somepage' => array(
            'label' => 'Me',
            'route' => 'somepage'
        )
    ),
    'sub' => array(
        'test' => array(
            'label'  => 'Test',
            'route'  => 'myroute',
            'action' => 'test'
        ),
        'other-test' => array(
            'label'  => 'Other Test',
            'route'  => 'myroute',
            'action' => 'other-test'
        )
    )
)

How do I use the navigation view helper so that it will print the correct menu for each call?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:28:38+00:00Added an answer on June 13, 2026 at 7:28 am

    The menu, breadcrumbs, sitemap and links helpers are registered as plugins. If you call $this->navigation('main_navigation') for the first time, the Zend\View\Helper\Navigation creates the container “main_navigation”. If you then call menu() for the first time the Zend\View\Helper\Navigation\Menu object is created and directly the container is injected.

    This indicates the flaw: if you call $this->navigation('sub_navigation') now, the navigation container is loaded in the navigation() view helper. When you then call menu(), the menu view helper is already created. So the new container is not injected anymore.

    Clearly this is a bug in the code base. There is one quick fix: the menu helper can also accept the container string:

    <?php echo $this->navigation()->menu('main_navigation'); ?>
    <?php echo $this->navigation()->menu('sub_navigation'); ?>
    

    I have filed an issue about it and the bug will be fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use JQuery to parse a sitemap.xml to look like this
I'm trying to use Navigation Tabs to change between some Fragments as like as
I'm trying to use extensions with Google's Protocol Buffers. I've got one main proto
I am need paint my image. I'm trying use JQuery in here this link:
I've been trying to use backbonejs and jqm together. I can render the main
I'm trying to use QSystemTrayIcon to display a message after application initialization. My main
I'm trying to use STL, but the following doesn't compile. main.cpp : #include <set>
I'm trying to use the Java Cassandra client Astyanax via Scala, but receiving this
My main view controller only supports landscapeleft and landscaperight. This viewcontroller in the viewDidLoad
I am trying to use a main,java to initiate 3 tabs, and have each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.