I have this ad program, and wanted to be sure I can use multi line ads so I can use JavaScript based ads in addition to <iframe> and <img> type ads.
<?php
$fcontents = join ('', file ('banner_ads.txt'));
$s_con = split("~",$fcontents);
$banner_no = rand(0,(count($s_con)-1));
echo $s_con[$banner_no];
?>
The code looks for a ~ on a line as the object separator. I was only concerned with an ad over several lines.
My Ad Rotator
Moderator: General Moderators
My Ad Rotator
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: My Ad Rotator
If your server runs on a system where line breaks are represented as ~s then you may have some problems.
But if not, and newlines are \r\n, \r, or \n, then everything should be fine.
But if not, and newlines are \r\n, \r, or \n, then everything should be fine.
Re: My Ad Rotator
What system(s) represent line breaks as ~s?tasairis wrote:system where line breaks are represented as ~s
Re: My Ad Rotator
It was sarcasm.Chalks wrote:What system(s) represent line breaks as ~s?tasairis wrote:system where line breaks are represented as ~s
Re: My Ad Rotator
So the punch line is this code will suffice as is?
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: My Ad Rotator
You might want to use explode() instead. Basically the same thing as split(), but *probably* faster.
Re: My Ad Rotator
Right now I have PHP5 on the machine, but I noticed PHP6 is up & coming. Any concerns with the widget?
I going to review explode and see if it is really worth the change, as is it serves the ads I have now, I wanted to see how big of an ad I can feed it.
Hard to find good books, I live in a smaller city
I going to review explode and see if it is really worth the change, as is it serves the ads I have now, I wanted to see how big of an ad I can feed it.
Hard to find good books, I live in a smaller city
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
