sarchi Posted September 11, 2007 Share Posted September 11, 2007 Hi, I tried installing this: http://simplythebest.net/scripts/DHTML_scripts/javascripts/javascript_54.html ....but it caused huge problems for people browsing with Safari and Mac's. I then tried installing this one: http://www.scripts.com/viewscript/rotating-advertisement-script/6418/ ....but I get some kind of simple parse error no matter how I configure it. You can see it (the error) in the header of my forum beside the Google ads. http://www.triumph675.net/phpBB2/ The error is always the same no matter what I try. (tried all their troubleshooting tips) My sponsors are getting annoyed, so if anyone has a quick/dirty fix it'd be MUCH appreciated. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Try using <?php instead of <?. It looks like you don't have short tags enabled. Quote Link to comment Share on other sites More sharing options...
sarchi Posted September 11, 2007 Author Share Posted September 11, 2007 Thanks, that didn't help though. The code is at the bottom of my overall_header.php file, which is basically an HTML doc. I tried adding </html> before the script call too.... this is the code; ..... <script type="text/javascript"><!-- google_ad_client = "pub-xxxxxxxxxxxx"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "FFFFFF"; google_color_bg = "F0F0F0"; google_color_link = "0000FF"; google_color_url = "008000"; google_color_text = "000000"; //--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </html> <?php include_once("http://www.triumph675.net/phpBB2/templates/subSilver/adrotation.php"); echo "<div align='center'>$bannerAd</div>"; ?> and this is the code in adrotation.php : <?php $bannerCounter= 1; $bannerCode[$bannerCounter] = "<A HREF=\"http://www.rampmotorcycles.com\"><IMG SRC=\"http://www.triumph675.net/phpBB2/templates/subSilver/images/ramp.gif\" BORDER=\"0\" HEIGHT=\"60\" WIDTH=\"468\" alt=\"Click to Visit RAMP Motorcycles\"></A>"; $bannerCounter++; $bannerCode[$bannerCounter] = "<a href=\"http://www.oncycles.com\" target=\"_top\"> <img src=\"http://www.triumph675.net/phpBB2/templates/subSilver/images/oncycles-2.gif\" width=\"468\" height=\"60\" alt=\"Click to Visit OnCycles Mall\" 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]; ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Your banner code is messed up: "<a href=\"http://www.oncycles.com\" target=\"_top\"> <img src=\"http://www.triumph675.net/phpBB2/templates/subSilver/images/oncycles-2.gif\" width=\"468\" height=\"60\" alt=\"Click to Visit OnCycles Mall\" border=\"0\">[/url]"; Why does it start with an HTML link and end with a bbcode link? Quote Link to comment Share on other sites More sharing options...
Dragen Posted September 11, 2007 Share Posted September 11, 2007 isn't the switching </a> with [/url] a feature of this forum... to stop links showing as links in quotes? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Add this to the top of the page: ini_set('display_errors', 1); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
sarchi Posted September 11, 2007 Author Share Posted September 11, 2007 SMF put those into my post...sorry, I didn't see a "disable BBCode" option. The <a> tags do end with < / a >. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 11, 2007 Share Posted September 11, 2007 it looks to me like $bannerAdTotals = $bannerCounter - 1; makes $bannerAdTotals == 1, so you're then trying to pull a random number from 1 to 1: $bannerPicked = mt_rand(1, $bannerAdTotals); I might do this as follows: $bannerCode = array(); $bannerCode[] = "Some URL"; $bannerCode[] = "Another URL"; $bannerPicked = mt_rand(0, count($bannerCode) - 1); $bannerAd = $bannerCode[$bannerPicked]; Note: As of PHP 4.2.0, there is no need to seed the random number generator with srand() or mt_srand() as this is now done automatically. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.