Member
Member
cox   2007-11-04, 15:39
#1

Hello people,

I was very happy to hear about the 1.1 release. Although it means that I have to change my theme (integrated in wordpress) slightly. While going through the new release I can't find how to reverse the sorting of (sub)albums.

I would like the newest albums on top.

I searched through the forum, but the relevant topics are related to previous releases, and I'm not PHP pro enough to feel confident changing to much code if i'm not sure i'm doing the right thing. So the question:

How do I reverse the sorting of (sub)albums in Zenphoto 1.1(!) (or where in the forum can I read the solution)

Cheers

Member
Member
sbillard   2007-11-04, 15:44
#2

In the admin edit page for the subalbum is a sorting selector. You can choose date, filename, title, and manual. There is no way sort order (low to high)of the first three options. If you click on the sort order link, you can drag and drop the albums into the sequence you wish.

Member
Member
cox   2007-11-04, 15:54
#3

Yeah I found those options. But it would be really great if Zenphoto would display the albums in my preferred order (newest on top) without me having to change the sort options. , or drag an album to the right place

Member
Member
sbillard   2007-11-04, 15:58
#4

Please put a ticket into the TRAC describing the feature and how you would like it to work.

Member
Member
elderz   2007-11-05, 19:40
#5

This is just a hack, but it should do what you want in the meantime without breaking anything else. In the zp-core/functions.php file in the sortAlbumArray function, add this code (line 633):

`$order = "";

if($sortkey='date') {

$order = " DESC";

}`

Edit the code on line 634 (now line 638) to read:

" ORDER BY " . $sortkey . $order);

instead of

" ORDER BY " . $sortkey);

This forces the results into a descending order when being pulled from the database if the sortkey is 'date'. Hopefully this helps.

Member
Member
elderz   2007-11-05, 21:18
#6

err...sorry about that last bit. I accidentally left it an assignment statement rather than compare. Use == instead of = in if($sortkey='date') {.

Member
Member
cox   2007-11-06, 13:15
#7

Thanks a lot elderz! Works like a charm!

Member
Member
elderz   2007-11-06, 15:05
#8

Glad to help. It might still be worth adding something to TRAC just so you don't have to do this again on the next release.

Member
Member
sbillard   2007-11-07, 02:41
#9

Implementation of sort-direction complete. Look for this in the 1.1.1 nightly build soon.

Member
Member
cox   2007-11-07, 10:16
#10

Great work!

Member
Member
elderz   2007-11-08, 15:30
#11

Thanks, sbillard!

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.