Thread: Simple ad rotater
dink

Here is a simple rotate script.


// rotate.

php

 

<?

php

 

$fcontents = join ('', file ('info.txt'));  // the text file can be any name you want
$s_con = split("~",$fcontents);

$ad_no = rand(0,(count($s_con)-1));
echo $s_con[$ad_no];

?>


The text file:


// info.txt
<a href="##"><img src="thong.jpg">Standard Thong</a><br />
~
<a href="##"><img src="p_thong.jpg">Pink Thong</a><br />
~
<a href="##"><img src="L_thong.jpg">Earl's Thong</a><br />
~
<a href="##"><img src="s_thong.jpg">Applauseink's Thong</a><br />



And finally, the useage:


//  pink_thongs.

php

 

<html>
.
.
.
.
<p>
Before you leave, please see our most recent sales items.  Here is a preview of the exciting bargains available. 
<? include("rotate.

php

 "); ?>
</p>
.
.
.
</html>


The rotate script will rotate anything that you have in the text file.  It is useful for inserting random strings in dynamic (db) description fields, in meta description fields, and the way I use it the most....different ppc ads on every page load.

You should note that you can have multiple rotates on each page.  ie, rotate.

php

 , rotate1.

php

 , etc.  As long as you have different text files to get your stuff from.  Additionally, you can name rotate.

php

  anything you would like (as long as it doesn't match any other names in your system).  The rotate.

php

  script above could have been named thongs.

php

  and it would do the same thing.


Dink


Perkiset's Place Home   Politics @ Perkiset's