AbsoluteGamerzNetwork
Absolute Gamerz

Rotaing Image Code?


Forum: Computers & Technology
Everything for your hardware gaming needs.
Topic: Rotaing Image Code?
Total Posts: 6

Corpral Hicks
Rank: 0
Posts: 497

I was wondering what the code is you use on the absolute sites to get a random banner everytime?

Prezes
Rank: 9
Posts: 896

a PHP script, were you get the list of images to show, then choose one at 'random' . Get the rest of the info for that image and insert it into the page.

for the game sites header images, them selves [as there are relatively few]. One holds them in an array, then 'randomly' select an element of the array.

Corpral Hicks
Rank: 0
Posts: 497

could you post me the code?

Prezes
Rank: 9
Posts: 896

the key is to generate a 'random' interger to select an item out of our list.

to do this one can use this:-

mt_srand((double)microtime()*1000000);
$random_int = mt_rand($min_value,$max_value);


hope that helps

Corpral Hicks
Rank: 0
Posts: 497

how do i actually make it know which images to choice from?

Prezes
Rank: 9
Posts: 896

$random_int will give a an integer value. This allows you to choose an element of an array of your images.

Say:-

$imgarray = Array('images1.jpg','images2.jpg','images3.jpg','images4.jpg','images5.jpg');

then use the random integer to select:-

echo $imgarray[$random_int];

similar thing with selecting from databases....

All copyrights and trademarks belong to their respective owners. This site is for the promotion of selected material, no infringements are intended. All reasonable efforts have been taken to credit the respective owners and/or authors.

AbsoluteGamerzNetwork

Cookie Policy | Privacy Policy

(US || 9b7b98444de6e53285624e3ab7e95d65)