|
Posted by Shelly on 07/27/06 00:17
"IchBin" <weconsul@ptd.net> wrote in message
news:Q32dneoT4vKNcVrZUSdV9g@ptd.net...
> Nospam wrote:
>> As requested
>> <?
>> $bannerCounter =1;
>>
>> $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=40371
>> 8&=1&fc1=<1=&lc1=&bg1=&f=ifr\" 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.site.com/site2\"
>> target=\"_top\"><img src=\"http://www.site.com/site1\" width=\"120\"
>> height=\"600\" alt=\"null\" border=\"0\"/></a> ";
>> $bannerCounter++;
>>
>> $bannerCode[$bannerCounter] = "<a href=\"http://www.site.com/site3\"
>> target=\"_top\"><img src=\"http://www.site.com/site3\" width=\"468\"
>> height=\"60\" alt=\"Click here !\" 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\")");
>>
>> var_dump($bannerAd);
>>
>>
> Sorry, I am very new to PHP. If I comment out:
>
> /*
> $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=40371
> 8&=1&fc1=<1=&lc1=&bg1=&f=ifr\" marginwidth=\"0\" marginheight=\"0\"
> width=\"120\" height=\"150\" border=\"0\" frameborder=\"0\"
> style=\"border:none\;\" scrolling=\"no\"> </iframe></a>\";
> */
>
> The error goes away. So I guess it is some where in this piece of code.
Very hard to read! Why use "\" as a quoting character here? Why not use:
$bannerCode[$bannerCounter] = '<a href="http://www.site.com/site1"
target="_top"><iframe ...etc... ';
Also, why are you quoting the semicolon when it is inside the outer quotes,
and hence will not be interpreted as a sentence end? Is it the right syntax
for "style"?
Shelly
[Back to original message]
|