ZenphotoCMS Forum
Help to customize a page - 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: Help to customize a page (/thread-7969.html)



Help to customize a page - risbac - 2010-12-16

I'm trying to customize a theme to add random photos.
Here is the idea:
-on the homepage, two random photos. Then the list of albums
-on an album page, if there are sub albums, two random photos from those sub albums, then the list of sub albums

I managed to do it on the homepage, but on the album page, no way to make it work:

basically, I'm just doing this twice:

"makeImageCurrent(getRandomImagesAlbum());
printCustomSizedImageMaxSpace(getImageTitle(),550,550);"

But then no way to display the sub albums: it just shows the photos of the sub gallery of the second random photo. I don't know how to "reset" the album page to display the sub albums. I'm a beginner with Zenphoto, sorry if it's a silly question.




Help to customize a page - sbillard - 2010-12-17

function saveContext() { global $_zp_current_album, $_zp_current_image; return array($zp_current_album,$_zp_current_image, get_context()); } function restoreContext($saved_context) { global $_zp_current_album, $_zp_current_image; list($_zp_current_album, $_zp_current_image,$context) = $saved_context; set_context(context); }
to use: before your code place

$context = saveContext();
and after place
restoreContext($context);

Caveat: I have just typed this in, there may be errors. But the idea is correct, just fix any thing I got a little wrong.