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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Different sort children for different pages?

Go to End



Community Member, 2 Posts

13 June 2013 at 4:19pm

Edited: 17/06/2013 2:20pm

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