Sigx

We are the future in the past.
It is currently Mon Mar 18, 2024 6:20 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Random Backgrounds
PostPosted: Fri Mar 12, 2004 6:01 pm 
Offline

Joined: Fri Mar 12, 2004 4:35 pm
Posts: 7
Here's my first contribution: Random background images

Code:
$randimg = rand (1, 4);
if ($randimg == 1){
   $backIMG = "blueclouds.png";
   }
else if ($randimg == 2){
   $backIMG = "redclouds.png";
   }
else if ($randimg == 3){
   $backIMG = "sunrise.png";
   }
else if ($randimg == 4){
   $backIMG = "dfsig.png";
   }


You essentialy count up how many random background images you have, and set that for the secound value in the rand function. So if you had 5 random backgrounds, your rand would look like rand(1,5) (In this case, 1 is the minimum random value, and 5 is the max). Then, in the big if-then tree, add in your images by their name. It doesn't matter what random number you associate them, because it's all random :D.

This code can go anywhere above the functions, like between line numbers 1 and 50. Also be sure to comment out (//)

"$backIMG = "sigtest.png"; // you can use URL for the image here too"

So that all that work you did doesn't get overwritten every single time :).

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group