Administrator
Administrator
fretzl   2008-12-28, 11:09
#1
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 ?
Member
Member
sbillard   2008-12-28, 20:48
#2
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.
Administrator
Administrator
fretzl   2008-12-29, 08:49
#3
Thanks for your reply.

This is what I have:

`
<?php if ((getOption('Randomimage')== '--Gallery--')) {
makeImageCurrent(getRandomImages(false));
printCustomSizedImageMaxSpace($alt='',600,600,NULL,NULL, false); }
// displays a random image from the entire gallery
else {
makeImageCurrent(getRandomImagesAlbum(getOption('Randomimage')))
printCustomSizedImageMaxSpace('',600,600,NULL,NULL, false);} ?>
//displays a random image from any other chosen album
`
Probably all wrong but maybe you can help me out.

Thanks
Administrator
Administrator
fretzl   2008-12-29, 17:44
#4
...and the passed parameter is the name of the dynamic album: `series.alb`
Member
Member
sbillard   2008-12-29, 23:11
#5
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);
`
Administrator
Administrator
fretzl   2008-12-30, 19:14
#6
Works! Thanks again sbillard.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.