Member
Member
sbillard   2007-07-09, 20:52
#1
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);

}

}

`
Member
Member
Barbara   2007-07-13, 14:22
#2
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
Member
Member
sbillard   2007-07-13, 16:04
#3
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.
Member
Member
zittoune   2007-07-20, 12:11
#4
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.
Member
Member
aitf311   2007-07-20, 14:22
#5
sbillard, Keep up the good work with this! ZP Lives!
Member
Member
sbillard   2007-07-21, 23:34
#6
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.
Member
Member
zittoune   2007-07-22, 09:44
#7
Ok I'll try that, thank you for your answer sbillard Smile
Member
Member
zittoune   2007-07-26, 14:37
#8
Couldn't test it before. The sort_order field is working fine Smile, I just didn't know how to use it.

Thank you sbillard Smile
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.