Merge 2 Php Codes.

liunx

Guest
Below I have 2 scripts, I was wondering if some one could write the second script into the first one? I've tried but each attempt fails. The first is a google ad block for 468x60 ads the second is a javascript ad rotator.<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><?php<br />if (eregi("block-GoogleBanner.php",$PHP_SELF)) {<br /> Header("Location: index.php");<br /> die();<br />}<br />?><br /><script language="JavaScript"><br /><!--<br />google_ad_client = "mycode";<br />google_ad_width = 468;<br />google_ad_height = 60;<br />google_ad_format = "468x60_as";<br />google_ad_type = "text_image";<br />google_ad_channel ="";<br />//--><br /></script><br /><?php<br />$content .= "<center><script language=\"JavaScript\"<br />src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">";<br />$content .= "</script></center>";<br />?><!--QuoteEnd--></div><!--QuoteEEnd--><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><script language="JavaScript"><br /><!-- Begin<br />rnd.today=new Date();<br />rnd.seed=rnd.today.getTime();<br /><br />function rnd() {<br /> rnd.seed = (rnd.seed*9301+49297) % 233280;<br /> return rnd.seed/(233280.0);<br />};<br /><br />function rand(number) {<br />var result = Math.ceil(rnd()*number);<br />if (!result)result++;<br /> return result<br />};<br />var ad_cnt2 = 2;<br />var ad2 = rand(ad_cnt2);<br />var link2;<br />var adBanner2;<br />var width2<br />var height2<br />if (ad2==1) {<br />link2="http://affiliates.phpfox.com/idevaffiliate.php?id=252_0_1_7";<br />adBanner2="http://affiliates.phpfox.com/banners/468x60_02.gif";<br />width2="468";<br />height2="60";<br />alt2="Your own myspace!";<br />}<br />if (ad2==2) {<br />link2="http://www.mysite/ads/treasure.gif";<br />adBanner2="http://www.treasuretrooper.com/141751";<br />width2="468";<br />height2="60";<br />alt2="Make money online";<br />}<br />document.write('<center><a href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"' + link2 + '" target="_blank">');<br />document.write('<img src=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"' + adBanner2 + '" width=' + width2 + ' height=' + height2 + ' border=0 alt="' + alt2 + '"></a>');<br />document.write('</center>');<br />// End --><br /></SCRIPT><!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
The title is a bit confused - the first snippet is PHP, but the second snippet is Javascript. You can't just mix them together.<br /><br />What is it you are trying to accomplish here? Rotate your Google ads?<!--content-->
No, I messed up. I want the google info out and I want the bottom script in. The bottom banner rotation javascript would be in the block instead.<!--content-->
 
Back
Top