here is the copy of the text file i used,
line one: entire text ad
line two: link to website
line three: image link
all new ads must start on lines 1,6,11,....
5 lines between each ad, which gives you two empty slots to grow into
Great family holidays at Haven Book your UK holiday or short break today at Haven and British Holidays. Visit our website today for a great family holiday. Fantastic offers at 38 great UK parks.<BR>
http://daniweb.com/
image1.gif
La Manga Club luxury villas & apartments, Spain La Manga Club luxury villas and apartments to rent including the exclusive Los Olivos development with indoor pool, jacuzzi, sauna and spa. 3 championship golf courses on this 5 star resort.<BR>
http://www.daniweb.com
image2.jpg
Discount cruises with Ocean Village Discover the best of the Mediterranean and Caribbean aboard the biggest, newest and best-equipped ship in its class - Ocean Village. It'scruising gone casual!.<BR>
http://www.brangle.com/
image3.jpg
and here is the php code, which i just dumped into a function:
<?
function getRandomText()
{
$r = 0;
$RANDOM_TXT_FILE = "sample_data.txt";
if (@file_exists($RANDOM_TXT_FILE))
{
$file = @file($RANDOM_TXT_FILE);
srand((double)microtime()*1000000);
$random = 5 * rand(0, (int) (sizeOf($file)/5));
unset($r);
$r['text'] = $file[$random];
$r['link'] = $file[++$random];
$r['img'] = $file[++$random];
}
return $r;
}
$random_text = getRandomText();
if (is_array($random_text))
{
echo "<a href=".$random_text['link']." ><img src=".$random_text['img']." ></a> - ".$random_text['text'];
}
?>
i sure hope this makes sense, if you start making this any more complicated then I stronly recomment moving this into a database otherwise this will work. if you have any questions with any of the lines of code above let me know and i will explain it to the best of my knowledge