Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Sidebars & Widgets »

Image rotation PHP script needs a tweak


 
Prev Previous Post   Next Post Next
  #1  
Old Jun 13, 2009, 03:33 PM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
Image rotation PHP script needs a tweak

This is what I want to do: I want a sidebar image rotation of a different image each day of the month, clicking through to different sponsor for each image. I found a PHP script that does the random image each day part, but I can't figure out how to include the link code for each image. Here is the script that works so far, and if anybody can show me how to put in the URL for each image to link to, I will be so happy! I've put in 2 images to test it. There will be up to 30 eventually. These are pictures of homes for sale, each one linking to an individual real estate agent's website. I tried sticking the URL right after the image code, but that made the whole thing break.

Code:
<?php

$totalPics="2";                    // Total photos in folder

$photoOfTheDay = Array (           // Add up to 31 photos below

   '1' => '/ads/weichert/0615Mary.jpg' ,     // Name of or Path to image
   '2' => '/ads/weichert/0619Janet.jpg' ,     // Name of or Path to image
   
);
//  published at: scripts.tropicalpcsolutions.com

// Place day of month in variable 'x'
//$x=date("d"); 
// A website vistor made a suggestion to change the date function to use j 
// instead of d. This causes the date to be read without leading zeros.
$x=date("j");  //Thanks for the suggestion Andrew

// If value of date exceeds the amount of photos then pick a random photo to display
if($x > $totalPics) { $x=rand(1,$totalPics); }

// Display image
echo <<<EOC
<center><img src="$photoOfTheDay[$x]"></center>
EOC;

?>
 

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Specific image rotation on page? blueprairie Header configuration & styling 3 Aug 8, 2009 03:12 PM
My <form> in Page can't find it's .php action script kathryn Atahualpa 3 Wordpress theme 2 Jun 7, 2009 10:08 AM
[SOLVED] Internet explorer v8 post pages not loading, also header rotation image issu bushtool Atahualpa 3 Wordpress theme 11 May 30, 2009 09:32 AM
How to enter a php script bilalasd Excerpts, Read more, Pagination 2 Apr 16, 2009 03:53 PM
How to use export.php script file to save theme changes? Andante New Versions, & Updating 1 Mar 22, 2009 06:36 PM


All times are GMT -6. The time now is 07:01 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.