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

Staff Page ***SOLVED***


4 Posts   566 Views


23 January 2012 at 3:25pm Community Member, 14 Posts

Sorry if this has been covered, but i couldn't find it...

I've created a page that lists all the staff etc on one page (based on tutorial.

The staff page is all good but i would like each staff member to be listed under their role, basically like how Silverstripe have done it with their team page

So CEO, Development, Design etc etc

Can someone point me in the right direction on what documentation i have to read up on?




24 January 2012 at 8:34am Community Member, 175 Posts


you should have a own field for the role, right?

so just generate a own dataobject with a special filter (SQL), where the result is such a listing ...


make a function in Page.php -> StaffMembers($role)

and in template you can call StaffMembers(CEO) to get the boss or StaffMembers(Devs) to get all the Developers

<% if StaffMembers(Devs) %>
<% control StaffMembers(Devs) %>
<% end_control %>
<% end_if %>


24 January 2012 at 9:29am (Last edited: 24 January 2012 9:30am), Community Member, 26 Posts

<% control StaffMembers.GroupedBy(Role) %>
   <% control Children %>
   <% end_control %>
<% end_control %>

or if Role is an object (has_one):
... GroupedBy(RoleID) [...] <h2>$Role.Title</h2> ...


24 January 2012 at 9:54am Community Member, 14 Posts

Thanks for the replies guys, i've got it to work now!

i was close but i was using <% control StaffMembers.groupBy(Role) %> so Plato's suggestion (.GroupedBy) worked a treat

thanks again