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***


Reply


4 Posts   603 Views

Avatar
vincent_vega

Community Member, 14 Posts

23 January 2012 at 3:25pm

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 http://www.ssbits.com/tutorials/2010/dataobjects-as-pages-part-1-keeping-it-simple/) 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 http://www.silverstripe.com/about-us/team/

So CEO, Development, Design etc etc

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

Cheers

V

Avatar
danzzz

Community Member, 175 Posts

24 January 2012 at 8:34am

hi,

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 ...

OR

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 %>

Avatar
Plato

Community Member, 26 Posts

24 January 2012 at 9:29am

Edited: 24/01/2012 9:30am

<% control StaffMembers.GroupedBy(Role) %>
   <h2>$Role</h2>
   <% control Children %>
      <h3>$Name</h3>
      $Photo
      etc.
   <% end_control %>
<% end_control %>

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

Avatar
vincent_vega

Community Member, 14 Posts

24 January 2012 at 9:54am

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