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.

Template Questions /

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

Output menu titles by field


Go to End


2 Posts   1722 Views

Avatar
sca123

Community Member, 61 Posts

14 April 2010 at 8:59pm

Edited: 14/04/2010 9:00pm

Ok, I have a site that uses a 1 level menu structure in the CMS but is shown on the front-end in sections. Each page is associated to a section through a field called "Section" which has the id 1 to 5.

So, what I need to do is output a sitemap broken down into sections. So I will hardcode the section name in the sitemap (Such as "News") then output all pages associated to "News".

So I will have something like:

NEWS
<% if Pages.Section = 1 %>
<% control [pages where Pages.Section = 1] %>
<a href="$Link">$Title</a>
<% end_control %>
<% end_if %>

I guess I will be need to create a control - but need help doing this.

Any help would be appreciated.

Avatar
sca123

Community Member, 61 Posts

14 April 2010 at 10:52pm

Fixed this issue by modifying the sitemap code. Thanks