0

The below template code from one of the tutorials on the official SilverStripe website ("How to create a navigation menu") includes the template variable $Menu(1)

What does the (1) mean? What happens if it gets changed to something else?

<ul>
    <% loop $Menu(1) %>
        <li>
            <a href="$Link" title="Go to the $Title page" class="$LinkingMode">
                $MenuTitle
            </a>
...
</ul>
Highly Irregular
  • 38,000
  • 12
  • 52
  • 70

1 Answers1

1

From the docs

<% loop $Menu(1) %> Begins a loop through all the menu items, repeating all the HTML that is in the loop for each one. By passing (1) as an argument, we are asking the CMS to give us all the pages at level 1 of the hierarchy. Changing that to (2) would give us all the pages at the second level of the hierarchy in the current section, and so on.

That's taken from the video tutorials they have up now

Nunser
  • 4,512
  • 8
  • 25
  • 37