Hello,
I have read through the forum to try to find the answer to my issue, but I can't seem to get it to work.
All I am trying to achieve is to get random images to be selected from one specific album.
The original code is this:
I changed it to this:
I am probably missing something very simple. Any suggestions would be appreciated. Thank-you!
Zenphoto version 1.4.2.3 [9980] (Official Build)
Current gallery theme: zpFocus_ v1.4.2.2
No errors posted and the page shows up, but the random images still are drawn from all albums. Just as if I changed nothing.
If you read the doc of that function it says "rootAlbum" which means it includes all sub albums, too.
Note that in the 1.4.3 dev the image_album_statistics plugin's function getImageStatistic() has also a random image function. This at least can get random images from just one album. See the documentation in the file itself.
Hello,
I only have top level albums (2), no sub-albums. I even cleared the albums cache. Is there another function to get a specific album?
Thank-you.
I am not sure what you mean. You need to tell the function what album to use. So you need to know it. Have you checked what album you actually get on the page you trying to use this? What exactly is this supposed to do? $ssalbum = $_zp_current_album->getFolder()=='appliances';
I have test albums (top level) called appliances and another called baby products. Using $ssalbum = $_zp_current_album->getFolder()=='appliances'; I want the random images to come from the appliances album only.
This is what the page source shows:
[list]
[*]
[*]
[*]
[*]
[*]
[/list]
These are the albums shown on the gallery page:
[list]
Appliances
Apr 20, 2012
tes test test »
Baby Products
Dec 19, 2010
test test test »
[/list]
When I tried to find the solution on the forum this is the code that I thought would work '$_zp_current_album->getFolder()=='name';'. "name" being album name. How should I tell the function what album to use?
Thank-you.
Hello,
I think I have figured out the answer to my question.
I changed the code to this:
'
'
Seems to work. Thank-you for your time!
Quote:$_zp_current_album->getFolder()=='name
Ahm, just to follow up that is wrong syntax. $_zp_current_album->getFolder() gets the name of the current album as the folder is the name (actual the path incl. parents toplevelfolder/sublevelfolder/...). This is the same as the object variable call $_zp_current_album->name.
So your change is exactly what you wish to do.