Announcement

Collapse
No announcement yet.

Possible to load a navigation set and then use it in a foreach loop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Possible to load a navigation set and then use it in a foreach loop

    I have situation where I need to load a navigation set to a custom variable and then use foreach to loop through the variable to display the navigation items. I don't want to use the navigation template due to my requirement.

    I was able to load the navigation set using the code below.

    Code:
    <mvt:item name="readytheme" param="Load_NavigationSet('main_menu', pcm_menu )" />
    And if I do &mvt:global:pcm_menu, I can see the entire structure of the menu. Where I am stuck is how to use the foreach loop to loop though the menu items. I tried something like below and was unsuccessful.

    Code:
    <mvt:foreach iterator="pcm_menu:item" array="pcm_menu:items">
       &mvt:global:pcm_menu:item:name;<br>
    </mvt:foreach>
    What am I missing or doing wrong?

    Thanks
    Keyboard Not Found..... Press F1 to continue

    #2
    Try something like this:

    Code:
    <mvt:item name="readytheme" param="Load_NavigationSet('main_menu')" />
    <mvt:foreach iterator="item" array="readytheme:loaded:items">
         &mvt:item:name;<br>
    </mvt:foreach>
    By default if you do not have a second parameter the values will be added to the l.settings:readytheme:loaded structure.

    Within that structure you can loop through the items array and get the values for the first level of links.
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Hi Nick,

      That worked perfectly, I was able to loop through all the child items too.

      Thanks
      Keyboard Not Found..... Press F1 to continue

      Comment

      Working...
      X