Jump to content

reverse sorting order


jeremie
 Share

Recommended Posts

Hi,

I'm very new to processwire and programming in general, but love to play with it.

On a page of my personal website listing my fav artists, I have this code

Quote

<div class="w3-container w3-third" style="max-width:400px">
            <?php $items = $pages->find("template=artist");
                        foreach ($items as $item){
                                    $thumb = $item->images->first()->size(300,300);
                                    echo "<div class='w3-card w3-margin jegreen' style='display:inline-block'>
                                                <a href='$item->url'>
                                                    <img src='$thumb->url'  alt='Too Bad' style='width:50%'>
                                                    <div class='w3-container'>
                                                        <h5>$item->title</h5>
                                                        <p>$item->body</p>
                                                    </div>
                                                </a>
                                    </div>
                                    <hr>
                        ";
            } ?>
        </div>
 

it works great, but it is sorting the "artist's containers" from the first I enter to the last.

I've tried to replace "first" by "last" but it is changing the image chosen for the container, not the order of appearance.

Then  I add 

Quote

 <?php $items = $pages->find("template=artist", "sort=-date");

but I didn't notice any change

Can someone help me out.

Thanks a lot

Edited by jeremie
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...