Can I show random photos from SPECIFIC album?
jhdesign
Joined: 2004-08-03
Posts: 26 |
Posted: Sat, 2004-08-14 16:24 |
I'm using block-random in Mambo and would like to show random photos from a specific album only. Is this doable? Thanks. |
|
Posts: 25
I'm not sure how you'd do that in Mambo, but I did something like that today in a non-CMS site. Pretty straight fwd, though there may be a better way...
...in the page of my site I am calling block-random from, I set a var for the album I want to draw from
...then in block-random.php look for
somewhere around line 71.
...comment that out and just below it, add the following
Works for me
Posts: 69
Is there a way to specifiy a particular album and then have block-random.php display images from nested albums in the specified album?
Posts: 3
alright, so i've just sorted this out myself, as it's exactly what i wanted...
i've only done this for the standalone version, and i've hardcoded in the album i want to change too... easily modified...
right at the bottom of block-random.php, inside the function scanAlbums() you have this bit of code...
you want to replace it with this...
this will re-initialise the cache with only albums that are sub-albums of your album... however, it won't take sub-albums and sub-albums... i don't think...
you may have to declare $rebuild=1; at the top to rebuild the cache if you've been working on it recently...
Posts: 69
Is there a way to specify the album with a variable as in verdon's post above?
Posts: 225
There is with an older version of random photo block. It allows you to do an include like this:
I don't think the random photo block in 1.4.4 allows this option.
Posts: 225
Here is the code from the older block-random.php. It also has the option of setting the image size and the target.
Posts: 3
well sure, instead of defining $myalbum, run a global on it, and then define $myalbum in your script before you include the random block... this should pass across the variables (i believe) although i haven't tested it.
i don't believe you can include files with a query string on the end of them. you could probably even define the specific album in the config file, but either way i think you'll have to make the variable global to allow the function to read it properly...
Posts: 69
This doesn't seem to be working for me. This is what I did:
In block-random.php, Find:
Replace with:
I included the block with this:
(My Gallery is embedded in phpBB.)
It just displays images like the regular random block. What am I missing?
Posts: 225
You can include with a query string .. but the newest 1.4.4 block-random doesn't support this. You can hack it so it does..
It makes it nice because you can use the same block-random on many pages and show a different album on each page.
I may be misunderstanding you guys but I really think you're making it harder than it should be ;)
Posts: 3
well no, that's why i put that code up, it's an extra 3 lines and an extra variable...
alpinezone, did you put
in that function? the scope of variables inside a function won't pickup the variable otherwise...
Posts: 69
In the include statement or in block-random.php?
Posts: 69
Any thoughts here?