ZenphotoCMS Forum
Numbering images - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Numbering images (/thread-4274.html)



Numbering images - Rain - 2008-12-17

By looking at another theme, I've managed to add the "Images 1-10 of 57" option to the album pages of the theme I'm working on by using the method below:

`




Numbering images - acrylian - 2008-12-17

echo "Image ". imageNumber()." of ".getNumImages() for example. All documentated on our functions guide by the way.
Since yout set the number of images per page you can use getOption('images_per_page') to calculate the x to y of z number thing.

the printf()/gettext() in your example is just for translation support via gettext. If you don't need that at all you can skip that. Without this would read echo "Images ".$firstimage." - ".$lastimage. " of ".getNumImages()




Numbering images - Rain - 2008-12-17

Thanks, the "Image # of #" works beautifully. Though with this echo "Images ".$firstimage." - ".$lastimage. " of ".getNumImages(); I get this output Images - of 76?

Edit // Never mind, just had to change "firstimage" to "firstImage", and "lastimage" to "lastImage". Thanks for the help!




Numbering images - Rain - 2008-12-17

getNumAlbums(); prints the number of total albums in the index, but is there a way to print the total number of images in all the albums as well? Couldn't find that in the functions guide. Same with returning something like "Albums 1-20 of 28" if I've set ZP to show 20 albums per page -- are these things possible?




Numbering images - acrylian - 2008-12-17

Sure, echo $_zp_gallery->getNumImages().




Numbering images - Rain - 2008-12-17

Oh excellent! What about the "Albums 1-20 of 28" if I've set Zenphoto to show 20 albums per page for example?




Numbering images - acrylian - 2008-12-17

$_zp_page stores the index/album page you are currently on and getOptions('albums_per_page') gets, well obvious, isn't it...:-). For the total number of albums you already now it. Just do some calculating based on the page number to achieve that.




Numbering images - sbillard - 2008-12-17

part of the code you have quoted is not related to the n-m of p so you can delete
if (isLandscape()) { $iw = 89; $ih = NULL; $cw = 89; $ch = 67; } else { $iw = NULL; $ih = 89; $ch = 89; $cw = 67;
being careful, of course to not screw up the if/else sets.

look at the Effervescence+ theme customfunctions. It has a printNofM() function.




Numbering images - Rain - 2008-12-17

Thanks! Clean code = good code.