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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

Iterate over Children that are not shown in the Menu


Go to End


4 Posts   3244 Views

Avatar
Andre

Community Member, 146 Posts

12 August 2009 at 10:42pm

Hi, I have a Page with lots of first level Children. The Page is iterating over all its children to show a small Teaser an a link (like the Staffmembers Tutorial).My Problem now is, that I don't want these Children to be shown in the Menu (only if its definitivly switched on). So all Children are by default "ShowInMenus" => 0.

But, if I use <% control Children %> in my template only those Children are taken which are aktivated to be shown in the menu.

Avatar
SilverRay

Community Member, 167 Posts

12 August 2009 at 11:34pm

If I understand you correctly:

<% control AllChildren %>

See http://doc.silverstripe.com/doku.php?id=built-in-page-controls

Avatar
Andre

Community Member, 146 Posts

13 August 2009 at 1:13am

That is exactly what i was looking for, many thanks.

Avatar
camfindlay

Forum Moderator, 267 Posts

3 September 2009 at 2:40pm

I have a similar problem but a bit more complicated I think,

I have a holder page with articles and I am showing a teaser for the articles on the holder page. The articles however are only fully accessible when a user signs up and is logged in. I have set the access of the individual articles to "Logged-in users".
The problem I have is that when I am NOT logged in the holder page will not show the teasers for the articles at all (assuming because the are bound by the access rule)

Is there a way to have a holder page display its children pages even if they are locked by the security methods?

At first I though the <% control AllChildren %> method above would work but it appears that only works for pages not shown in the menu system.

Will I need to perhaps write an action in the Holder page's controller to achieve this?