poMONKey Posted April 11, 2007 Share Posted April 11, 2007 I have a script that loads a new banner when the page is refreshed: <?php $ban1 = "/Banners/apiana_leaderboard_728x90.jpg"; $url1 = "# target=_blank"; $ban2 = "/Banners/herios_leaderboard_728x90.jpg"; $url2 = "# target=_blank"; $ban3 = "/Banners/Links%20of%20London.GIF"; $url3 = "# target=_blank"; $ban4 = "/Banners/1473RCHorbanner.jpg"; $url4 = "# target=_blank"; $randomNum = rand (1,4); $image = ${'ban'.$randomNum}; $url= ${'url'.$randomNum}; Print "<a href=".$url." mce_href=".$url."><img src=".$image." border=0></a>"; ?> This code is in an included php header and I have the same code out in the separate pages throughout the site to shuffle the banners. Everything is working just fine until the client wants to synchronize the header banners with the page banners. Thats where I hit a wall as far as coding php goes... how do I make the header talk to the pages and load the same company's banner in both places??? TIA p0 Quote Link to comment Share on other sites More sharing options...
Stuie_b Posted April 11, 2007 Share Posted April 11, 2007 You could try using a session... For Example you could set the banner id in a session then each time a banner is loaded you could check too see if a session is set, if it is it will load the banner in the session if not run the random banner script. hope it helps Stuie Quote Link to comment Share on other sites More sharing options...
only one Posted April 11, 2007 Share Posted April 11, 2007 if you want to show the same companys banner in two places on the page just use 2 variables.. <?php $ban1 = "/Banners/apiana_leaderboard_728x90.jpg"; $secondban1 = "banner.."; $url1 = "# target=_blank"; $randomNum = rand (1,4); $image = ${'ban'.$randomNum}; $image2 = ${'scondban'.$randomNum}; $url= ${'url'.$randomNum}; Print "<a href=".$url." mce_href=".$url."><img src=".$image." border=0></a>"; ?> now just echo $image2 further don the page.. Quote Link to comment Share on other sites More sharing options...
poMONKey Posted April 11, 2007 Author Share Posted April 11, 2007 Thanks for the responses... I almost have it and mostly understand - but Im no echoing the banner image correctly. Heres how Ive been coding it: <?php echo "${secondban1}"; ?> all that does is print out the URL for the banner, it doesnt actually display it... halp! Quote Link to comment Share on other sites More sharing options...
only one Posted April 11, 2007 Share Posted April 11, 2007 lol, no, Print "<a href='$url' mce_href='$url'><img src='$image2' border=0></a>"; Quote Link to comment Share on other sites More sharing options...
poMONKey Posted April 11, 2007 Author Share Posted April 11, 2007 holy COW! not even close ... my n000000biness will surly see me back here ~ thanks for the help only 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.