Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Include / Daily Image Rotater

Aloittaja Moif, toukokuu 30, 2008, 07:34:57 AP

« edellinen - seuraava »

Moif

Hi all, me again.

I'm trying to incorporate a script that will display an image depending on the day of the week. I've found this code:


<?php

/**
 * Change the name of the image folder
 *
 * Images must be named Monday.gif, Tuesday.gif etc
 */

// Change to the location of the folder containing the images
$image_folder "images/days";

// You do not need to edit below this line

$today date('l');
if (
file_exists($image_folder."/".$today.".gif")) {

  echo 
"<img src=\"$image_folder/".$today.".gif\">";

}

else {
  echo 
"No image was found for $today";

}

?>



Which works fine here:

http://forums.brap.fm/Themes/default/image.php

I've created a folder called 'days' inside my 'images' folder and it's display a pink gif named 'Friday.gif'. Which is great.

What I'm trying to do is have that pink block appear next to our big flash 'CLICKME' thing here: http://forums.brap.fm/index.php

I've got the table code already in there (commented out at the moment) and if I try and place that script within the table block I don't see the image, only the 'No image was found for $today' output. Which again, is working as intended. Or not, as the case may be.

I'm also omitting the <? php and ?> as I get a synax error. I've also tried to include the image.php

include("image.php");

..but to no avail.

Where am I going wrong? I'm trying not to use an IFRAME as that messed things up slightly.



vbgamer45

I would just put this code in the template


/**
* Change the name of the image folder
*
* Images must be named Monday.gif, Tuesday.gif etc
*/

// Change to the location of the folder containing the images
$image_folder = "images/days";

// You do not need to edit below this line

$today = date('l');
if (file_exists($image_folder."/".$today.".gif")) {

  echo "<img src=\"$image_folder/".$today.".gif\">";

}

else {
  echo "No image was found for $today";

}


And change
$image_folder = "images/days";

To be the full path to the images folder
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: