Jump to content

sorting images using pages


jploch
 Share

Recommended Posts

Hello!

I have a problem with the order my images display on a gallery iam building for my new homepage.

My gallery displays an image for every page that has the parent "work" and the field thumbnail.

It works, but the images seemes to be sorted by the time the page was createted. I want the order of the images to be the order of the pages (I want to use the "move" button in pw to  rearrange them).

Here is my code:

<?php
 $projects = $pages->find("parent=/work/");
        foreach($projects as $project) {
         $out .="<a href='{$project->url}' class='item {$project->thumbnail->tags}'>";
        if($project->thumbnail){
            $out .="<img src='{$project->thumbnail->url}'>";
        }
        $out .="<div class='item-info'><h1>{$project->title}</h1><p>{$project->thumbnail->description}</p></div>";
        $out .="</a>";
        }
    echo $out;
?>

Thanks!

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...