Jump to:

23552 Posts in 19349 Topics by 2891 members

General Questions

SilverStripe Forums » General Questions » Different sort children for different pages?

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: 245 Views
  • Emeloh
    Community Member
    2 Posts

    Different sort children for different pages? Link to this post

    The general situation:

    - I have a list of topics which are assigned people (or people are assigned topics - under a man_many relationship), which are broken up into categories (I have CategoryHolder that groups all of the topics of and a Category page).

    CategoryHolder is parent to Category is parent to Topic.

    I pull this information onto my CategoryHolder page like this:
    <% loop Children %>
    <h3>$Title</h3> <!-- Category title -->
    <div id="wrapper2">
    <% loop Children %>
    <li><a href="$Link" title="$Title">$Title</a>$Intro </li><!-- Topics for this category -->
    <% end_loop %>

    This is great! Exactly what I want for this page.

    But now, they want to change it so that on the individual people pages, Instead of having the topics sorted alphabetically within their categories they want all the topics assigned to that person listed alphabetically overall.

    Is there a way that I can do this?

    So Example

    On the categoryholderpage page I have:

    - Ancient
    - Middle Ages
    - Post Modern

    - Biology
    - Chemistry
    - Physics

    But I want on the peoplepage, for the user:

    Prof FakeName
    - Ancient
    - Biology
    - Post Modern

    Instead of:

    Prof FakeName
    - Ancient
    - Post Modern
    - Biology

    I'm really not sure how to fix this, any suggestions would be greatly appreciated.

    ETA: I found a fix to sort by titles on the people page:

    <% control Topics.sort(Title) %>
    <p> <a href="$Link" title="$Title">$Title</a>
    <% end_control %>

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.