You are here: Re: banner rotation script « All PHP « IT news, forums, messages
Re: banner rotation script

Posted by Geoff Berrow on 07/28/06 01:44

Message-ID: <Pjbyg.50811$eQ.10168@newsfe7-win.ntli.net> from Nospam
contained the following:

>> >$bannerCode[$bannerCounter] = "<a href=\"http://www.site.com/site1\"
>> >target=\"_top\"><iframe
>>
>>src=\"http://www.site.com/e/cm?t=site1&o=2&p=6&l=bn1&mode=site1&browse=4037
>1
>> >8&=1&fc1=&lt1=&lc1=&bg1=&f=ifr\" marginwidth=\"0\" marginheight=\"0\"
>> >width=\"120\" height=\"150\" border=\"0\" frameborder=\"0\"
>> >style=\"border:none\;\" scrolling=\"no\"> </iframe></a>\";
>> >$bannerCounter++;
>>
>> Missing quote mark at end.
>>
>it is now saying $BannerAd undefined

Actually the quote is not missing, you have escaped it when you should
not have.

I don't get any errors with the following (the document.write seems
pointless but I'll let you sort that out)

<?
$bannerCounter =1;

$bannerCode[$bannerCounter] = "<a href=\"http://www.example.com/site1\"
target=\"_top\"><iframe src=\"http://www.example.com/site1\"
marginwidth=\"0\" marginheight=\"0\" width=\"120\" height=\"150\"
border=\"0\"
frameborder=\"0\" style=\"border:none;\" scrolling=\"no\">
</iframe></a>";
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"http://www.example.com/site2\"
target=\"_top\"><img src=\"http://www.example.com/site2\" width=\"120\"
height=\"600\" alt=\"null\" border=\"0\"/></a> ";
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"http://www.example.com/site3\"
target=\"_top\"><img src=\"www.example.com/site3\" width=\"468\"
height=\"60\" alt=\"site 3\" border=\"0\"/></a>";
$bannerCounter++;

$bannerCode[$bannerCounter] = "<a href=\"<a
href=\"http://www.example.com/site4\" target=\"_top\"><img
src=\"http://www.example.com/site4\" width=\"600\" height=\"500\"
alt=\"null\" border=\"0\"/></a>";
$bannerCounter++;





$bannerAdTotals = $bannerCounter - 1;
if($bannerAdTotals>1)
{
mt_srand((double)microtime() * 1234567);
$bannerPicked = mt_rand(1, $bannerAdTotals);
}
else
{
$bannerPicked = 1;
}
$bannerAd = $bannerCode[$bannerPicked];

$bannerAd = str_replace('"', '\'', $bannerAd);
print("document.write(\"$bannerAd\")");

?>

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация