Hi,
All my albums have sort order "Date Descending" thus i've uploaded all my files in such fasion that the first picture in the album always is the last one uploaded in that particular album.
This works fine when browsing normally through the gallery.
However, i've added a button to call "Last Updated Albums" which basicly shows all the new albums created. In this case all the thumbnails for the albums are the first picture uploaded, which means the default sort order here is date ascending. I was wondering how i could change this behaviour.
The code i use to call "Last updated album" is following:
config > themes settings > Custom menu link name Last updated albums
config > themes settings > Custom menu link URL thumbnails.php?album=lastalb
I'm guessing it could be as easy as just changing the link url to something that tells it to sort by descending? Otherwise it's probably possible to modify the code part in include/functions.inc.php case 'lastalb': // Last albums to which uploads
if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = $lang_meta_album_names['lastalb'].' - '. $CURRENT_CAT_NAME;
} else {
$album_name = $lang_meta_album_names['lastalb'];
}
$META_ALBUM_SET = str_replace( "aid", $CONFIG['TABLE_PICTURES'].".aid" , $META_ALBUM_SET );
$query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid";
$result = cpg_db_query($query);
$count = mysql_num_rows($result);
mysql_free_result($result);
$query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
if ($set_caption) build_caption($rowset,array('ctime'));
$rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);
return $rowset;
break;
To add the sorting somehow?
I'm no professional! Would love some help.
Thank you.