I have implemented sorting for Subalbums that mimics the sorting for Albums. Of course, no Admin interface yet, but you can set the sort_order field via SQL or (at least with my ISP) the phpMyAdmin interface.
Replace the getSubAlbums 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);
}
}
`
Comments
Parse error: syntax error, unexpected T_GLOBAL, expecting '{' in /home/******/public_html/photos/zen/class-album.php on line 101
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.
The sort only goes on the sort_order field, so you will have to order that the way you want your subalbums to appear.
Thank you sbillard