davo Posted February 27, 2014 Share Posted February 27, 2014 Hi I usually know how to sort an array of pages but i'm a little stuck this time. I'm sure it's pretty obvious. foreach($page->children as $child) { $class = $page === $child ? " class='on'" : ''; if($child->DMC_represented!=0) { echo "<li> <a$class href='{$child->url}'> <span class='label label-default'> {$child->DMCcontact_Country}</span> {$child->title}</a></li>"; } } How would I sort the results in this case A-Z by the DMCContact_Country field please? David Link to comment Share on other sites More sharing options...
adrian Posted February 27, 2014 Share Posted February 27, 2014 foreach($page->children("sort=DMCContact_Country") as $child) { $class = $page === $child ? " class='on'" : ''; if($child->DMC_represented!=0) { echo "<li> <a$class href='{$child->url}'> <span class='label label-default'> {$child->DMCcontact_Country}</span> {$child->title}</a></li>"; } } 1 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