Yesterday I made the switch from my old blog to a new location and a new theme. I took the blog out of www.rickety.us and exported my posts to a new database. To redirect I wrote the following code in the index.php:
<?php
header( 'Location: http://www.rickety.us' ) ;
?>
Of course I began to alter the theme immediately. I made 24 new banners and used the rotator script to randomly change the banner. If you refresh the page the banner will often change. Once I have seven more banners I can change to displaying a different banner for every day of the month. I can do this by changing the code from:
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along
header('Location: '.$folder.$files[$rand]); // Voila!
to this:
// A different banner for each day. Make sure you have 31 banners.
$when=getdate(date("U"));
header('Location: '.$folder.$files[$when[mday]]); // Yeah!
To test this I added seven more geese banners and that is why when I switch from daily banners to random banners you will more often get geese on a refresh.
This new theme is fluid and handles widgets better than the old theme. A link to where I got it from is in the footer. Tell me what you think of the new theme. Do you like it better than the old one?
Anonymous says
Could I get that in English, er, American English?
Max
rickety says
In American English it reads, “You get a different photograph displayed each time.”
Marc Chen says
Dear Rickety:
Am just wondering if it’s possible to modify the script so that images could be randomly rotated after certain period of time (e.g. 5 sec) w/o refreshing the webpage? Thanks.
rickety says
That is a good question. I don’t know the answer. At first I ran the script so the page would change each day but that involved a refresh also. What you want to do is a great idea, especially if the user could set a switch to do it. You probably already know but the banners are itemized on two blog posts: A Banner Story and A Banner Story Continued. I show almost all the banners and the photograph they were cropped from and also give a little background. Thanks for your comment and enjoy your day.