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.

General Questions /

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

[solved] Menu structure - Best practice


Reply


5 Posts   1621 Views

Avatar
slamby

Community Member, 21 Posts

13 March 2009 at 6:59am

Edited: 13/03/2009 9:08pm

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?

Avatar
dab

Community Member, 50 Posts

13 March 2009 at 9:37am

Hello,

look at http://doc.silverstripe.com/doku.php?id=recipes:page_selection_for_special_menu
I think this is what you need.

Avatar
slamby

Community Member, 21 Posts

13 March 2009 at 10:30am

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.

Avatar
dab

Community Member, 50 Posts

13 March 2009 at 11:35am

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.

Avatar
slamby

Community Member, 21 Posts

13 March 2009 at 9:07pm

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.