Jump to:

23480 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Staff Page ***SOLVED***

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

Page: 1
Go to End
Author Topic: 547 Views
  • vincent_vega
    Avatar
    Community Member
    14 Posts

    Staff Page ***SOLVED*** Link to this post

    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

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: Staff Page ***SOLVED*** Link to this post

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

  • Plato
    Avatar
    Community Member
    26 Posts

    Re: Staff Page ***SOLVED*** Link to this post

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

  • vincent_vega
    Avatar
    Community Member
    14 Posts

    Re: Staff Page ***SOLVED*** Link to this post

    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

    547 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.