Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Menu2 not working in my template like it did in the tutorial

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

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

Page: 1 2
Go to End
Author Topic: 3930 Views
  • sonicparke
    Avatar
    74 Posts

    Menu2 not working in my template like it did in the tutorial Link to this post

    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.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

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

  • sonicparke
    Avatar
    74 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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) %>

  • sonicparke
    Avatar
    74 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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 %>.

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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.

  • sonicparke
    Avatar
    74 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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?

  • dio5
    Avatar
    Community Member
    501 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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?

  • sonicparke
    Avatar
    74 Posts

    Re: Menu2 not working in my template like it did in the tutorial Link to this post

    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.

    3930 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.