selinap.com

To leave furtively and stealthily.

Archive for the ‘PHP’ Category

9 ways to hide affiliate links

Monday, August 18th, 2008

These codes are useful for hiding the affiliate links. However, please read the affiliate program terms of service, so that you won’t go against it.

(more…)

Wordpress: Display posts by categories

Thursday, July 10th, 2008

This function could be used to display all categories and their posts. One example of its usage is for the Archive page.

(more…)

Nuffnang vs Advertlets at random

Wednesday, June 25th, 2008

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

(more…)

Create a Rotating Ads

Friday, June 13th, 2008

If you run more than one ads, but lack of space to put the ads, you can actually rotate the ads.

The code below will create a random number from 1 to 10. Since I want both ads to be shown with a probability of 50%, I put the condition if (x > 5). You can change this number.

1
2
3
4
5
6
7
8
9
10
<?php $x = rand(1,10); ?>
<?php if ($x > 5) { ?>
 
<!--your first ad code-->
 
<?php } else {?>
 
<!--your second ad code-->
 
<?php } ?>

You can read more about PHP rand() function here.


© Copyright 2008 - 2009 selinap.com
Entries (RSS) and Comments (RSS).