From time to time it may be useful to change sorting order of images and albums without
actually renaming them. With this customization it possible to assign a sorting index to any image or album,
and this index will take preference over a filename.
With this customization installed, every album and image will have an extra field "SortOrder" in
.albumdef.ini file. This field will also be visible in album properties. Pictures with SortOrder=0 (default) go first,
followed by pictures with SortOrder=1, followed by SortOrder=2 and so on.
For example, there are three albums "One", "Two", "Three". By default DAlbum sorts them alphabetically
as "One", "Three", "Two". One way of ordering them correctly would be to rename albums as "01-One", "02-Two", "03-Three",
but the same result can be achieved by setting:
- SortOrder=1 for album "Two"
- SortOrder=2 for album "Three"
Album "One" will have SortOrder empty which means 0.
After reindexing albums will appear in correct order as "One", "Two", "Three".
A working example can be seen in samples where album
"LeMassif" was assigned SortOrder=-1 and therefore is listed before other albums.
Instructions
1. Edit you custom.php and subclass CAlbum and CImage classes by adding the following code to the bottom of the file.
2. If you already have subclassed any of these classes before, you may need to change CAlbum/CImage strings in the code
above with a subclassed name and delete duplicate customCreateImage/customCreateAlbum functions. See bonus pack source code for an example.
3. Reindex. Please note that if you change SortOrder of an album, the changes will apply only after reindex
|