Subscribe to Selinap.com feed right now!  Get Updates by Email

Nuffnang vs Advertlets at random

This tutorial will show on how to make Nuffnang and Advertlets ads to display at random (not at the same time on each page).

First you need to put this code in the header.php file.

<?php 
  global $x;
  $x = rand(1,2);
?>

This code will generate a random number of 1 and 2, and then substitutes it to the global variable x.

Next, insert the nuffnang and advertlets inside the code below.

<?php if ($GLOBALS['x'] == 1) { ?>
 
<!--nuffnang-->
 
<?php } else {?>
 
<!--advertlets-->
 
<?php } ?>

Now, just copy the code and paste it into the template, as many as desired.

The code will show one or more nuffnang or advertlets ads at random with a chances of 50%.

Tags: , ,

If you liked this post, these other posts might also be interesting to you:

4 Comments »

  1. Avatar

    suka ngan theme neh. hehe :mrgreen:
    KNizams last blog post..I’m Yours - Jason Mraz

    Comment by KNizam — June 25, 2008 @ 5:33 pm

  2. Avatar

    KNizam: Thank you

    Comment by riza — June 26, 2008 @ 5:20 am

  3. Avatar

    useful. i made 3 of them.
    1. adsense
    2. nuffnang
    3. advertlets

    haneps last blog post..Paper product prices increase 10% to 40%?

    Comment by hanep — June 26, 2008 @ 11:28 am

  4. Avatar

    hanep: That’s great

    Comment by riza — June 26, 2008 @ 1:31 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Allowed tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

Recent Readers: