News:

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

Main Menu

Just thinking of a rotating banner heading

Started by 123kid, August 13, 2008, 10:10:23 PM

Previous topic - Next topic

123kid

Thansk for SMF, works like a charm for us ;)

We have multiple board heading designs like google that interchanged weekly...

But then i was curious if there is a mod to install or a code to modify in board.index.template that would rotate our board heading image for like every page load or scheduled every day/week/months.

We have like almost 10 board heading designs already and it would be really helpful for us if we could have this, for us not to manually overwrite our board heading image via FTP every week ;)

TIA! and More power!

ccbtimewiz

If you know some PHP, you could do something like:

$x = array( "image1.jpg","image2.jpg","image3.jpg" );
$y = rand( 0,2 );
$z = $x[$y];

echo '<img src="static URL/$x">';


Just add more images to the array and increase the rand range.  Then have the Static URL correct for the location of the image you'll be using.

Though if you want it timed, I'm not quite sure. You'd need to use some javascript at that point. What I showed you does it upon every page load.

123kid

#2
Quote from: ccbtimewiz on August 14, 2008, 12:24:26 AM
If you know some PHP, you could do something like:

$x = array( "image1.jpg","image2.jpg","image3.jpg" );
$y = rand( 0,2 );
$z = $x[$y];

echo '<img src="static URL/$x">';


Just add more images to the array and increase the rand range.  Then have the Static URL correct for the location of the image you'll be using.

Though if you want it timed, I'm not quite sure. You'd need to use some javascript at that point. What I showed you does it upon every page load.
thanks for the quick reply :) but i'm not that good in php could you provide the exact full code where to insert, what line, what to replace... :) tia!

Advertisement: