|
Randomising page elements with php includes
I'm building a site with some advertising on. There are 15 possible adverts, and I wish to call up only 5 on any page.
I'm calling up the ads in a slightly random manner, via php include statements:
[code:1:2c63422be7]
<?php include 'ad' . rand(1,3) . '.php' ?>
<?php include 'ad' . rand(4,6) . '.php' ?>
<?php include 'ad' . rand(7,9) . '.php' ?>
<?php include 'ad' . rand(10,12) . '.php' ?>
<?php include 'ad' . rand(13,15) . '.php' ?>
[/code:1:2c63422be7]
I would like to completely randomise the order in which the 15 adverts are called - ie, so they can appear in any order.
I would also like to be able to automatically remove one or more ads at random, to help randomise the entire display. For example, if ads 1,4,7,10 and 13 are called, I would like to see a script remove one or two of these randomly.
Is this going to be easy for someone to script for? What would such a script look like?
Or would I be asking for too much?
|