WebsiteBaker Support (2.8.x) > Droplets & Snippets

Random Image folder

(1/1)

Jaz:
Hi,

Just wondering if this is possible.  I have been using the RandomImage snippet successfully on one of my sites and am now re-developing another site using WB.  Is it possible to code the RandomImage call so that it uses a variable in the directory name (I want to use a different set of images on each page).

I basically need some help coding the call in index.php so that the photo source directory name includes the page title as a subdirectory added to it - then in my random_image directory I will have subdirectories named the same as each page.  My PHP is pretty crappy so I'm not sure how to add this. Sorry if this is a bit confusing I've tried to explain what I mean in code below  :|

I currently have
--- Code: ---     <?php RandomImage (&#39;/media/random_image/&#39;); ?>
--- End code ---

but need it to be
--- Code: ---     <?php RandomImage (&#39;/media/random_image/{value of PAGE_TITLE}/&#39;); ?>
--- End code ---

Could someone suggest how I go about this please ?

kweitzel:
Try:


--- Code: ---<?php RandomImage (&#39;/media/random_image/&#39;.PAGE_TITLE.&#39;/&#39;); ?>

--- End code ---

cheers

Klaus

Jaz:
God how embarrassing that is such a simple solution - must have been having a blonde day   :oops:

Thanks :-D

Navigation

[0] Message Index

Go to full version