PHP Link/Image Ads

[418 Clicks]


How To Display Hyperlinks And Images Correctly In RSS Feeds

I'm not fond of having to include third-party ads from a purely programmatic standpoint. Network latency is one of the main gremlins that comes to mind when trying to reduce load-in page speeds. And it's one of the main reasons why I don't include many ads in current sites. And when you factor in the irrational fear of JavaScript, you begin to understand why there is abundant reticence on the part of many site owners currently. I've been loathe to either include ad-server content (holding back your page from loading before ads do), or JavaScript-based ad-service. But, as the former owner of a PayPalâ„¢-enabled shopping cart, I had to search for ways to link to products there in the old article directory to give them more visibility.

Front Door Of The Old Cartdrone Site

As usual, PHP to the rescue! I found a simple way to rotate both text-link or image ads, and differently than previous methods I investigated. Now, I was able to stack a group of ads together, and then, with each refresh of the page, have a different ad in place. There's no need for even an ad server with this coding solution, since as ads grow in amount over time, they can be called via a PHP "include" statement so the size of the file doesn't interfere with your page load;

$num = Rand (1,3);
switch ($num)
case 1:
echo '

\r\n<>br />

Sample Link
Illustration Of Embedded Link

case 2:
echo '


Sample Link
Illustration Of Embedded Link

case 3:
echo '
PHP Rotation Coding Sample

In the above example, you have a tabular setup for the first two ads, and then an example of an image link, which can have a text link substitute by removing the "img src" part. Try this PHP coding technique where you don't want to use JS, but you want to be able to circulate ads on the page without taking up space.

Resource Box


Mr Lee Davis is the owner/admin of, an instant publishing site for news, articles, information, multimedia, and infographic submissions along with exposure to profitable opportunities associated with content creation. Are you a content creator in need of a way to double your content output while halving creation time? Info can be found at the 100% UNIQUE Articles salespage


RSS, Feeds, Coding