21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 255 Views |
-
Staff Page ***SOLVED***

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
-
Re: Staff Page ***SOLVED***

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 %> -
Re: Staff Page ***SOLVED***

24 January 2012 at 9:29am Last edited: 24 January 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> ... -
Re: Staff Page ***SOLVED***

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
| 255 Views | ||
|
Page:
1
|
Go to Top |



