In The craft
Rotating Header
A friend asked how I created the rotating header effect. There are multiple ways doing it so this may not be the most efficient but it works for me.
I created a function to open a file and add all the lines into an array. Then it randomly picks one of values in the array. The point of this file is – I can drop the header files into the general image directory without giving them any special treatment.
Here is the code I used to achieve the effect.
Rotating Header Function
function rotate_header() {
srand((double)microtime()*1000000);
$tiplist = file("tips.lst");
echo $tiplist[array_rand($tiplist)];
}