WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: Jaz on January 26, 2008, 06:53:16 PM

Title: Random Image folder
Post by: Jaz on January 26, 2008, 06:53:16 PM
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: [Select]
    <?php RandomImage (&#39;/media/random_image/&#39;); ?>
but need it to be
Code: [Select]
    <?php RandomImage (&#39;/media/random_image/{value of PAGE_TITLE}/&#39;); ?>
Could someone suggest how I go about this please ?
Title: Re: Random Image folder
Post by: kweitzel on January 28, 2008, 09:34:13 PM
Try:

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

cheers

Klaus
Title: Re: Random Image folder
Post by: Jaz on February 06, 2008, 03:24:28 AM
God how embarrassing that is such a simple solution - must have been having a blonde day   :oops:

Thanks :-D