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

Show in menu & missing content


Go to End


4 Posts   2787 Views

Avatar
benedictporter

Community Member, 16 Posts

18 November 2008 at 12:45am

I am building a site that uses part of it's Home page to hold content from a couple of subpages. I don't want these pages to show up in my dropdown menu so I have unchecked the 'Show in menu box' and now the content has disappeared from the Home page.

I'm using <% control Children %> to put the content there in the first place (I have a 'HomePage' page type with 'DidYouKnow' specified as its children). Is this the right thing to do? How do I get my content back without it appearing in the menu?

Code:
<div id="holder">
<% control Children %>
<div class="image">$Photo.SetWidth(96)</div>
<div class="title"><h1>$Title</h1></div>
<div class="text">$Content</div>
<div class="clear"></div><!-- clearing div -->
<% end_control %>
</div>

Avatar
benedictporter

Community Member, 16 Posts

19 November 2008 at 11:58pm

I've managed to sort this now.

I wrote a jQuery script to apply the class .hideme to the menu items I wanted to disappear and used CSS to display: none;

Seemed a lot easier that trying to muck about with the code. If anyone has an alternative solution then I would love to hear it.

Avatar
Liam

Community Member, 470 Posts

20 November 2008 at 2:19pm

<% control AllChildren %> will show all content, even those where the option to 'show in menu' is not checked.

Avatar
benedictporter

Community Member, 16 Posts

20 November 2008 at 9:57pm

Thanks for that, LeeUmm. A very simple solution to a problem that had been driving me nuts for most of the day. Still, at least I learnt a little jQuery along the way which can't be a bad thing.