Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hello,
i am using wordpress
the problem is that how to display random ads
on it
i have find the place where the ad is automatically added when we post but i am
using adbrite and i have 4 adzone i want that
when page is loaded the 4 ads get randomly
displayed atleast 1 time each and can repeat
after ever post
please help me
thanks

Hi, perhaps try coding an ad randomizer in PHP using the rand() function. Just assign each image and a link a number, and the banner that matches to the random number generated is displayed.
$Img1 = "http://domain.com/image1.jpg";
$Url1 = "http://domainname.com";$Img2 = "http://domain.com/image2.jpg";
$Url2 = "http://domainname.com";$Img3 = "http://domain.com/image3.jpg";
$Url3 = "http://domainname.com";$Img4 = "http://domain.com/image4.jpg";
$Url4 = "http://domainname.com";$random = rand(1, 4);
$Image = ${'Img'.$num};
$URL = ${'Url'.$num};Then insert your print or echo PHP code here using the $Image for the 'img src' and $URL for the 'a href' variables.

hey thanks for it
but i want that i want to randomly display adbrite.com ads
they are like adsenseplease help me

![]() |
problem in uploading a fi...
|
free web host help
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |