ZenphotoCMS Forum
Subalbum sorting - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Subalbum sorting (/thread-1536.html)



Subalbum sorting - sbillard - 2007-07-09

I have implemented sorting for Subalbums that mimics the sorting for Albums. Of course, no Admin interface yet, but you can set the [b]sort_order[/b] field via SQL or (at least with my ISP) the [b]phpMyAdmin interface.

Replace the [/b][b]getSubAlbums[/b] function in class-album.php with the code below:
`

function getSubAlbums($page=0) {

  function sortSubalbumArray($albums) 

global $_zp_gallery;

if (is_null($this->subalbums)) {

  $dirs = $this->loadFileNames(true);

  $subalbums = array();

  foreach ($dirs as $dir) {

    $dir = $this->name . '/' . $dir;

    $subalbums[] = $dir;

  }

  $sortedSubalbums = $_zp_gallery->sortAlbumArray($subalbums); 

  $this->subalbums = $sortedSubalbums;

}

if ($page == 0) { 

  return $this->subalbums;

} else { 

  $albums_per_page = zp_conf('albums_per_page');

  return array_slice($this->subalbums, $albums_per_page*($page-1), $albums_per_page);

}

}

`




Subalbum sorting - Barbara - 2007-07-13

It's not working for me.

Parse error: syntax error, unexpected T_GLOBAL, expecting '{' in /home/**/public_html/photos/zen/class-album.php on line 101




Subalbum sorting - sbillard - 2007-07-13

Probably a transcription error. Download the efferevescence_simpleviewer theme from the WIKI, the function is included in the copy of class-album.php included with the theme.




Subalbum sorting - zittoune - 2007-07-20

Hello,

The sorting is not working for me. It's not the same sorting as the one with the previous function, but it's still not sorted as I want.

I tried to put a value in the sort_order field but it's still not sorted.

What should I do if I want my subalbums sorted by folder name ?

Thanks.




Subalbum sorting - aitf311 - 2007-07-20

sbillard, Keep up the good work with this! ZP Lives!




Subalbum sorting - sbillard - 2007-07-21

zittoune: You need the subalbum support hacks that are included in the effervescence_simpleviewer theme. See the readme file in the download.

The sort only goes on the sort_order field, so you will have to order that the way you want your subalbums to appear.




Subalbum sorting - zittoune - 2007-07-22

Ok I'll try that, thank you for your answer sbillard




Subalbum sorting - zittoune - 2007-07-26

Couldn't test it before. The sort_order field is working fine , I just didn't know how to use it.

Thank you sbillard