Forum Moderators: coopster
I'm thinking of making a script that will rotate banners every hour.
The way I see it is:
get time;
if first number (hour)is positive ie. -->12:00
banner one
else
banner two
Hey don't laugh!
This is how I see it but can't code it yet.
Do you think it's doable?
My buddy recommended PHP unleashed, would that be a good book to start with for a newbie?
So far I have read a few tutorials online and got really interested.
Thanks for your help!
<?PHP
//reduce to 12 links for 12 hour
$url = array('http://link1.com', 'http://link2.com',
'http://link3.com', 'http://link4.com', 'http://link5.com',
'http://link6.com', 'http://link7.com', 'http://link8.com',
'http://link9.com', 'http://link10.com', 'http://link11.com',
'http://link12.com', 'http://link13.com', 'http://link14.com',
'http://link15.com', 'http://link16.com', 'http://link17.com',
'http://link18.com', 'http://link19.com', 'http://link20.com',
'http://link21.com', 'http://link22.com', 'http://link23.com',
'http://link24.com');//reduce to 12 images for 12 hour
$img = array('img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg',
'img5.jpg', 'img6.jpg', 'img7.jpg', 'img8.jpg', 'img9.jpg',
'img10.jpg', 'img11.jpg', 'img12.jpg', 'img13.jpg', 'img14.jpg',
'img15.jpg', 'img16.jpg', 'img17.jpg', 'img18.jpg', 'img19.jpg',
'img20.jpg', 'img21.jpg', 'img22.jpg', 'img23.jpg', 'img24,jpg');//could also do another array for alt text
//and another array for text link under banner// 0-23 (24 hour format)
$hr = date(G);// 1-12 (12 hour format)
//$hr = date(g);$x=0;
while($x <= $hr){
if($x == $hr){
echo "<a href=$url[$x]><img src=path/to/pics/$img[$x]></a>";
$x++;
}//close if x
else {
$x++;
}//close else}//close while
?>
Hope it helps.
As for your question on books, maybe someone else can help you there. My suggestion is to have a look at what your local library has to offer before comitting to a single book. Our library system has well over 100 books on php alone. I grab a few, read em and go get a few more, etc, etc. LOL