ZenphotoCMS Forum
Error random image from dynamic album - 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: Error random image from dynamic album (/thread-4330.html)



Error random image from dynamic album - fretzl - 2008-12-28

Zenphoto 1.2.2 [3131] - default theme.

I am using getRandomImagesAlbum() on my index.php.

When I set the function to choose from a dynamic album I get this error:

Fatal error: Call to a member function getSearchEngine() on a non-object in path-to-zenphoto\zenphoto\zp-core\template-functions.php on line 2920

It works fine with all the other "normal" albums.

Any ideas ?




Error random image from dynamic album - sbillard - 2008-12-28

It seems to be working in the Efferevescence+ theme. Maybe we need more information. The error you are getting indicates that the "album" was not an object. So how was getRandomImagesAlbum() called? Any parameters? If no parameters were passed it is an indication that $_zp_current_album is not setup. If you did pass a parameter, then there is something wrong with that parameter.




Error random image from dynamic album - fretzl - 2008-12-29

Thanks for your reply.

This is what I have:

`

//displays a random image from any other chosen album
`
Probably all wrong but maybe you can help me out.

Thanks




Error random image from dynamic album - fretzl - 2008-12-29

...and the passed parameter is the name of the dynamic album: series.alb




Error random image from dynamic album - sbillard - 2008-12-29

Ok, Got it. The code in getRandomImagesAlbum that reads:
if ($album->isDynamic()) { $search = $_zp_current_album->getSearchEngine(); $images = $search->getImages(0);
needs instead to say
if ($album->isDynamic()) { $search = $album->getSearchEngine(); $images = $search->getImages(0);




Error random image from dynamic album - fretzl - 2008-12-30

Works! Thanks again sbillard.