Author Topic: Random Image folder  (Read 3120 times)

Jaz

  • Guest
Random Image folder
« 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 ?
« Last Edit: January 26, 2008, 06:54:55 PM by Jaz »

Offline kweitzel

  • WebsiteBaker Org e.V.
  • **
  • Posts: 6983
  • Gender: Male
Re: Random Image folder
« Reply #1 on: January 28, 2008, 09:34:13 PM »
Try:

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

cheers

Klaus

Jaz

  • Guest
Re: Random Image folder
« Reply #2 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

 

postern-length