Jump to content

sorting pages


davo
 Share

Recommended Posts

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


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>"; 

    }

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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