Member
Member
reneesanguinetti   2012-05-03, 15:06
#1

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

Administrator
Administrator
acrylian   2012-05-03, 15:20
#2

Parameters look good so far. What is the probably actually? Nothing shows up? Error, if which?

Member
Member
reneesanguinetti   2012-05-03, 15:44
#3

No errors posted and the page shows up, but the random images still are drawn from all albums. Just as if I changed nothing.

Administrator
Administrator
acrylian   2012-05-03, 16:20
#4

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.

Member
Member
reneesanguinetti   2012-05-03, 16:45
#5

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.

Administrator
Administrator
acrylian   2012-05-03, 17:15
#6

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';

Member
Member
reneesanguinetti   2012-05-03, 17:33
#7

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]

Administrator
Administrator
acrylian   2012-05-03, 19:00
#8

Your code is not properly escaped (use backticks!). If you want to have only and always the album "appliance" why do you have $_zp_current_album->getFolder() in there?

Member
Member
reneesanguinetti   2012-05-03, 19:09
#9

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.

Member
Member
reneesanguinetti   2012-05-03, 21:55
#10

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!

Administrator
Administrator
acrylian   2012-05-04, 08:50
#11

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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.