Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Menu2 not working in my template like it did in the tutorial


Go to End


13 Posts   4793 Views

Avatar
sonicparke

74 Posts

15 November 2007 at 10:41am

If I understand it correctly I can create a new page and put subpages under that and those become Menu2. I then assumed I could put <% inlcude Menu2 %> in the footer and I would get the sub menu on every page. But that's not working. I'm only getting it on the parent page.

I didn't use any if blocks so I'm not sure why it's not showing up on every page. I get the html from my include just not the actual list items.

I'm sure I'm missing something obvious but I'm having trouble seeing it.

Avatar
Sam

Administrator, 690 Posts

15 November 2007 at 3:35pm

* Did you misspell include? It's misspelled in your forum post.
* Did you try ?flush=1
* Does templates/Includes/Menu2.ss exist?

Avatar
sonicparke

74 Posts

16 November 2007 at 3:41am

Edited: 16/11/2007 3:42am

All good questions.

I double checked and it's spelled correctly. The signals between my brain and fingers do get confused often but usually only when I'm typing quickly like on a forum post or an Im or something. :-)

Yes. I have used ?flush=1 on the db, admin, & live site every time I've made a change hoping that would work.

Yes Menu2.ss does exist.

The interesting part is this...

This is the code for Menu2.ss:

<div>
<ul id="Menu2">
    <% control Menu(2) %>
      <li class="$LinkingMode"><a href="$Link" title="Go to the $Title page">$MenuTitle</a></li>
    <% end_control %>
</ul>
</div>

on all the pages it out puts this:

<div>
<ul id="Menu2">


</ul>
</div>

But only on the home page where the subpages reside does it actually output the menu.

So the include part is working but not the <% control Menu(2) %>

Avatar
sonicparke

74 Posts

16 November 2007 at 11:25am

I guess it would be helpful to mention that I started with the Blackcandy theme which may be why it's not working correctly. Maybe it's setup a little different and it's not as simple to just use <% include Menu2 %>.

Avatar
dio5

Community Member, 501 Posts

16 November 2007 at 12:12pm

Just to make sure: you're not wanting them to show up on the same level as home page, are you?

You mean that you don't see the submenu in the subpages themselves, no?

If you want the submenu to show up on the same level pages as homepage, that won't work of course.

Avatar
sonicparke

74 Posts

16 November 2007 at 12:20pm

Actually that's exactly what I'm trying to do. Basically I'm looking for an easy way to have a secondary menu in the footer on each and every page including home regardless of the pagetype. Is there not an easy CMS way to do this? AM I going to need to hard code them into the footer?

Avatar
dio5

Community Member, 501 Posts

16 November 2007 at 12:32pm

Mm,

I'm not sure I completely understand you...

A submenu would only give a submenu when the parent page has subpages... :-)

Now when you only have subpages under home, it's quite obvious that they're not showing up in for example 'about', unless about also has subpages...

So it's not that kind of submenu you're after I suppose?

Avatar
sonicparke

74 Posts

16 November 2007 at 12:38pm

no it's not. Say I have 10 top level pages in the site tree. None with subpages. I want 5 of those to be the main navigation menu. Then the other 5 to be a secondary menu for less important pages. This secondary menu will reside in the footer while the main nav menu will be in a main content column which is common. Both menus need to be on every page.

Look here: http://urltea.com/248e

You'll see the main nav menu on the left and a column in the footer where the links to other internal pages should go.

Go to Top