Nuffnang vs Advertlets at random

Wednesday, June 25th, 2008
Advertisement

Subscribe.
Enter your email:

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%.

If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Creates the exact copy of your hard disk and allows you to instantly restore the entire machine.
New Acronis True Image Home 2010 is the most reliable and easy in use backup solution. Now with online backup option!
15% Discount Code: FMAATIH2010

What else?

Like this article? Share it

 Digg  del.icio.us  TwitThis  Facebook  Reddit  StumbleUpon

6 Responses to “Nuffnang vs Advertlets at random”

  1. KNizam says:

    suka ngan theme neh. hehe :mrgreen:

    KNizams last blog post..I’m Yours – Jason Mraz

  2. Selinap says:

    KNizam: Thank you

  3. hanep says:

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

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

  4. Selinap says:

    hanep: That’s great

  5. Faiz says:

    aku ingt blog ape tdi…gila style~

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>