General Community > Scripting Help

How To Make Random Header Images

(1/1)

mindazor:
hallo evry one I nead a Code How to make Random Header Background Images?

Like this one: hxxp:"http://zaxo.at/index.php?action=forum;theme=22" [nonactive]

Looking:
There are many ways to do this but it is more than the code, you will need to implement it in theme properly but in any case you could use PHP to do a random pick between numbers and then put the class in relevant place like:


--- Code: ---$random=rand(1,3);
$headercss="cssclass";
if($random==2){$headercss="cssclass2";}
if($random==3){$headercss="cssclass3";}
--- End code ---

Sir Osis of Liver:
Can also do it like this -


--- Code: ---
$pic = rand(1,5);

echo '
<img src="',$settings['images_url'],'/img/topr', $pic ,'.jpg" alt="" />';


--- End code ---

Where images are topr1.jpg, topr2.jpg, etc.

Navigation

[0] Message Index

Go to full version