Web Site Adverts Coding

Started on the old forum in February 2009 · view the original in the archive · old links redirect here

9 replies · 825 views · started 17 years ago · 1 min read

4 participants
djsammy Junior · 43 posts #1

hi there friends can some one help me with some coding for random adverts for a web site i am making please it would be a create help if some one could help me out please thanks very much.......... i've tryed looking on google and can not find any thing that works i just want it so it comes up with the name of the advert and the when some one clicks on the link it takes then to a site

sorry if this in wrong place did not now where to put this

wap2k Developer · 168 posts #2

OK this is as simple as you need it :

replace the // PUT YOUR ADVERT CODE HERE with different advert codes

//chooses a random number between 0 and 4

$adnumber = Rand (0,4); 

//starts the random quote switch loop for selecting the advert with the random number

switch ($adnumber) { 
case 0: 

// PUT YOUR ADVERT CODE HERE

break; 

case 1: 

// PUT YOUR ADVERT CODE HERE

break; 

case 2: 

// PUT YOUR ADVERT CODE HERE

break; 

case 3: 

// PUT YOUR ADVERT CODE HERE

break; 

case 4: 

// PUT YOUR ADVERT CODE HERE

break; 
} 
?>
djsammy Junior · 43 posts #3

QUOTE (wap2k @ Feb 25 2009, 04:37 AM) <{POST_SNAPBACK}>

OK this is as simple as you need it :

replace the // PUT YOUR ADVERT CODE HERE with different advert codes

CODE //chooses a random number between 0 and 4

$adnumber = Rand (0,4);

//starts the random quote switch loop for selecting the advert with the random number

switch ($adnumber) { case 0:

// PUT YOUR ADVERT CODE HERE

break;

case 1:

// PUT YOUR ADVERT CODE HERE

break;

case 2:

// PUT YOUR ADVERT CODE HERE

break;

case 3:

// PUT YOUR ADVERT CODE HERE

break;

case 4:

// PUT YOUR ADVERT CODE HERE

break; } ?>

so where its got // PUT YOUR ADVERT CODE HERE do i put the web site address there

wap2k Developer · 168 posts #5
<?php

//chooses a random number between 0 and 4
$adnumber = Rand (0,4); 
//starts the random quote switch loop for selecting the advert with the random number

switch ($adnumber) { 
case 0: 

print "<a href=\"http://www.site1.com\">http://www.site1.com</a>";

break; 

case 1: 

print "<a href=\"http://www.site2.com\">http://www.site1.com</a>";

break; 

case 2: 

print "<a href=\"http://www.site1.com\">http://www.site3.com</a>";

break; 

case 3: 

print "<a href=\"http://www.site1.com\">http://www.site4.com</a>";

break; 

case 4: 

print "<a href=\"http://www.site1.com\">http://www.site5.com</a>";

break; 
} 
?>
djsammy Junior · 43 posts #6

QUOTE (wap2k @ Feb 25 2009, 03:48 PM) <{POST_SNAPBACK}>

CODE

<?php //chooses a random number between 0 and 4 $adnumber = Rand (0,4); //starts the random quote switch loop for selecting the advert with the random number switch ($adnumber) { case 0: print "<a href=\"http://www.site1.com\">http://www.site1.com</a>"; break; case 1: print "<a href=\"http://www.site2.com\">http://www.site1.com</a>"; break; case 2: print "<a href=\"http://www.site1.com\">http://www.site3.com</a>"; break; case 3: print "<a href=\"http://www.site1.com\">http://www.site4.com</a>"; break; case 4: print "<a href=\"http://www.site1.com\">http://www.site5.com</a>"; break; } ?>

can i add more links to it as well my friend

wap2k Developer · 168 posts #7

Yes just add a new loop and change the random number to the amount of links

case 5: 
print "<a href=\"http://www.site1.com\">http://www.site6.com</a>";
break;
djsammy Junior · 43 posts #8

QUOTE (wap2k @ Feb 25 2009, 11:11 PM) <{POST_SNAPBACK}>

Yes just add a new loop and change the random number to the amount of links

case 5: 
print "<a href=\"http://www.site1.com\">http://www.site6.com</a>";
break;

coding dont work on me web site

ori Lead · 512 posts #9

some ad sites use a file so jus use like

case 0: 
include('adfile1.php');
break;
hectoth Junior · 19 posts #10

djsammy wrote: hi there friends can some one help me with some coding for random adverts for a web site i am making please it would be a create help if some one could help me out please thanks very much.......... i've tryed looking on google and can not find any thing that works i just want it so it comes up with the name of the advert and the when some one clicks on the link it takes then to a site

sorry if this in wrong place did not now where to put this

not possible if you can't code the advertising. Close to this anyways, all I know is MobGold's GoldLink, which require you to just put the details that you used for other networks. It at least save you from coding but you must always put their code to your site.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close