Hi,
I m using google adsense for my board. i dont want to show those public service ads which doesnt pay anything. Instead, i wish to add some referal ads which cud be accomplished while setting up the google adsense code. i can choose an alternate ad link(html) which google will display that ad instead of displaying the public service ads.
But my problem is, i need to display multiple alternate ads randomly instead of those public service ads.
plz help.
Create a simple php script that would generate random ads html, and point adsense to it for alternate ads.
It could be as simple as
<?
$ads[0]='
html code for this add
';
$ads[1]='
another add html
';
$ads[2]='
and yet another
';
echo $ads[rand(0,count($ads))];
?>
Or could store ads in a table in a database and do some queries... there are many ways but the one above is the fastest and easiest for someone who doesn't have a lot of experience.
Thanks a lot for this quick reply.
I did as u said but its not working. here is the code tat i tried.
<html>
<head>
<title>Text Link Ads</title>
</head>
<body>
<?
$ads[0]='
<a href="http://www.text-link-ads.com/?ref=78638" target="_blank"><img src="http://www.text-link-ads.com/images/text_link_ads_C_728x90.gif" border="0" alt="Text Link Ads"></a>
';
$ads[1]='
<script src=http://www.hostmonster.com/src/js/dinesh/CODE10/720x90/1.gif></script>
';
echo $ads[rand(0,count($ads))];
?>
</body>
</html>
it just displays the first ad but its not clickable. the second ad never gets displayed.
plz help mate. thanks
<html>
<head>
<title>Text Link Ads</title>
</head>
<body>
<?
$ads[0]='
<a href="http://www.text-link-ads.com/?ref=78638" target="_blank"><img src="http://www.text-link-ads.com/images/text_link_ads_C_728x90.gif" border="0" alt="Text Link Ads"></a>
';
$ads[1]='
<script src="http://www.hostmonster.com/src/js/dinesh/CODE10/720x90/1.gif"></script>
';
echo $ads[rand(0,count($ads))-1];
?>
</body>
</html>
Man, thanks a lot for spending your time, but same thing with the above script too. plz help
p.s if you know any public ad management scripts then do plz point me. i planned to remove those adsense banners and place complete set of referral banners. i need a script to display them randomly. plz help. your script is cool and its understandable for a novice like me. if you can do tat then plz help me with your script irself. thanks a lot.
I don't know what's the problem on your side. it's working fine for me ... anyway.(btw you should remove the <html> and <head> tags as you are displaying those inside another page so there's no reason to use them.
anyway, you can find a list of php ad managers here:
http://www.hotscripts.com/PHP/Scripts_and_Programs/Ad_Management/index.html
Thanks a lot man. i ll try both of them. thanks a lot for spending your precious time.
EDIT:
MAn your script is working great when i removed the html , head codes and saved it as php. but do u know how to display them with the ad management mod found here. i PM'd u the link to the php script. thanks
Well... if you use an ad management script you don't need that code :). Because that's the purpose of ad manangements scripts. ;)
okey then how can i use your script to display the banners. i want to display them on all pages/top as like the one google adsense ad displayed currently. i m using this mod.
http://custom.simplemachines.org/mods/index.php?mod=255
i m not sure whether i can use this mod for u r script.
plz help man. this place is really great like a quick support. thanks a lot for this aswell as the smf script.
I'm not very familiar with that mod, but I know it supports php code for the ads code.
So just create an ad on your forum, and paste the php code above, inside the adcode box.
aww it shows some error with load.php.
man do u hav any idea to link that php script (lol im confused) located at www.mysite.com/banner/advt.php . a html code to run tat php script or watever. plz help. thanks a lot for ur great help :D.
Thanks Remaker, i got another simple php script to display them and it worked. thanks a lot for your time.
This is solved now. ???
ye, i changed the message icon already 8).