Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » [solved] Menu structure - Best practice

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1559 Views
  • slamby
    Avatar
    Community Member
    21 Posts

    [solved] Menu structure - Best practice Link to this post

    Give the case I would like to implement a web site structure with 2 independent menu trees like:

    - Products
    - Contact Us
    - About Us
    ....

    and the second with:
    - Legal
    - Login
    ....

    What would be best practice implementing this including all facettes of silverstripe like breadcrumps, controlling menus and so on?

    I would gues I could need something like that:

    - MenuContainer
    -- TopNavigation
    ----- Products
    ----- About Us
    ----- ....
    -- SecondNavigation
    ----- Legal
    ----- Login
    ----- ...

    Am I wrong/right?

  • dab
    Avatar
    Community Member
    50 Posts
  • slamby
    Avatar
    Community Member
    21 Posts

    Re: [solved] Menu structure - Best practice Link to this post

    Thanks for the answer.

    This is a interesting feature. It provides a kind of "quick link" feature and can be applied to any menu item. Also it could be changed by the admin whenever needed by checking the checkbox.

    But unfortunately this is not what I am looking for.

    What I would need is a really independent second menu which is not integrated into the rest of the menu.

  • dab
    Avatar
    Community Member
    50 Posts

    Re: [solved] Menu structure - Best practice Link to this post

    Hello, you may use it totally independent:
    in your Page_Controller

       function topMenu(){
          $whereStatement = "ShowInTopMenu = 1";
          return DataObject::get("Page", $whereStatement);
       }

    and in your template:

    <ul><% control topMenu %>
    <li class="$FirstLast $LinkingMode"><a href="$Link" title="$Title.XML"><span>$MenuTitle.XML</span></a></li>
    <% end_control %></ul>

    And you get new menu by checking "Show in Top Menu" checkbox and uncheck show in menu.

  • slamby
    Avatar
    Community Member
    21 Posts

    Re: [solved] Menu structure - Best practice Link to this post

    Thanks a lot. This one indeed is what I was looking for.
    This hint was what I needed:
    "And you get new menu by checking "Show in Top Menu" checkbox and uncheck show in menu."

    Also changing the where statement to get it:
    Just grab those which are flagged with "ShowInTopMenu".

    Thanks again.

    1559 Views
Page: 1
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.