Jump to content

Recommended Posts

Posted

Hello! I'd like to sort search results by title within their parents' parent. This sorts by title alone:

foreach($pages->find("template=individual")->sort(title) as $individual) {

echo "<option value='".$individual->name."'>[".$individual->parent->parent->title."] ".$individual->title."</option>\n";    

}

And gives me something like

<option value="Bob">[Grandpa Joe] Bob</option>

I'd like to list all grandchildren of Grandpa Joe in order, then all grandchildren of Grandpa Lou, etc, grouped by grandparent name. What's the best way to do that?


 

Posted

I guess this will work:

$pages->find("template=individual, sort=parent.title, sort=title");

$pages->find("template=individual, sort=parent, sort=title");
  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...