reordering album and image display order in album.php

Hi guys!

I need to reorder the way albums and images are displayed on album.php so that they are arranged in descending order of date created irrespective of whether the object displayed is an album or image.

Refer below for pseudocode:

------------------------------------------------
ORIGINAL "default" theme album.php
------------------------------------------------

while (next_album()):
display album image with link, description, etc... ;

while (next_image(false, $firstPageImages)):
display image with link, title, etc... ;

_____________________________________________________________

------------------------------------------------
REQUIRED "default" theme album.php
------------------------------------------------

next_album();
next_image();

while (getAlbumDate() || getImageDate()):
{
if (getAlbumDate() > getImageDate())
{
display album image with link;
next_album();
}

else
{
display image with link;
next_image();
}

}

end while;

_____________________________________________________________

Of course, I am assuming at this point that getAlbumDate() and getImageDate(), which are pseudo names for the real functions whatever they may be, return null values when there are no more albums or images.

So what I'm asking is, is it possible to do this with the way ZenPhoto's functions are written now, without modifying the core?

Just throwing out my ideas at the moment...

Thanks!
- Fuge B

Comments

  • fugeb Member
    Crap ... no indentations ... oh well, its still understandable...
  • Do you mean that the images must be by date no matter which album that they come from?

    If you just want the images within an album to be in date order, use the sort order options. If you want the above you will have to collect all the images names into an array along with their album folders and dates, then sort that array.

    the pseudo code would be somethin like:

    `
    $imagelist = array();
    while next_album(0) {
    $albumfolder = $_zp_current_album->folder;
    while next_image() {
    $imagelist[] = array('folder'=>$albumfolder, 'name'=>$_zp_current_image->name, 'date'=>$_zp_current_image->getDate();
    }
    }
    sortMultiArray($imagelist, 'date');
    foreach ($imagelist as $imagerow) {
    $image=Newimage(New Album($_zp_gallery, $imagerow['folder']), $imagerow['name');
    ....print the image....
    }
    `
Sign In or Register to comment.