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.

Template Questions /

two or more IDs on <% control ChildrenOf(right_here) ??


Reply


2 Posts   607 Views

Avatar
arthgwyr

Community Member, 1 Post

22 April 2012 at 7:55am

Hi, I'm new on SilverStripe, and I want to use it on my portfolio, I'm a webdesigner
I have this structure:

-Home
-Contact
-Projects
--Identity
---1
---2
---3
--Packaging
---a
---b
---c
--Wayfinding
---i
---ii
---iii
I'm using a custom subtemplate for HOME and I want it to display a grid or table with all the projects I have done:

PROJECTS
1 2 3 a b
c i ii iii

is there a page control to get all the grandchildren from "Projects", I've read http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls but I couldn't find anything, also I want them to apear in random order, that's why I'm looking for one instruction instead of writing:

<% control ChildrenOf(__________)%>

for every grandchildren in order to achieve it

Thanks

and sorry for my really lame english =/

Avatar
zenmonkey

Community Member, 528 Posts

28 April 2012 at 2:56am

You'd need to do <% control ChildrenOf("Projects") %> <% control Children %> Your COde <% end_control %><% end_control %>

Remember once you're in a control loop any method available to that control are exposed. So once you're in ChildrenOf("Projects") anything available on Project is available to you