caribou Posted August 26, 2013 Share Posted August 26, 2013 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? Link to comment Share on other sites More sharing options...
arjen Posted August 26, 2013 Share Posted August 26, 2013 I guess this will work: $pages->find("template=individual, sort=parent.title, sort=title"); $pages->find("template=individual, sort=parent, sort=title"); 2 Link to comment Share on other sites More sharing options...
caribou Posted August 28, 2013 Author Share Posted August 28, 2013 Thanks very much, this worked! In this case, rootParent worked too. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now