HomePHP Page 5 - Commercial Break (A phpAds Primer)
Room With A View() - PHP
Wanna make some money from your Web site? The simplest way tostart is by opening it up to advertisers - and if you decide to go thatroute, you're going to need a capable banner management program to helpyou keep track of customers, banners and clicks. Lukily, we've got justthe thing - say hello to phpAds.
Remember how, a couple of pages back, you wondered what the AdViews, AdClicks and AdDays parameters were for in the client administration screen, and I rudely told you to shut up and sit down? Well, now that you know how banners work, it's safe to revisit those three mysterious parameters, and see where they fit in.
The AdViews parameter lets you specify the number of times the client's banners should be displayed to site visitors, while the AdClicks parameter lets you specify the number of banner clicks purchased by the client. The AdDays parameter lets you specify a duration for which the client's banners are valid; this value is used to calculate the expiry date for the customer's banners.
It should be noted, however, that the values above are largely toothless tigers, since phpAds does not automatically terminate display of the customer's banners once any of the values are exceeded. Rather, it merely uses them to warn the customer when his account is about to expire. This behaviour is somewhat strange - ideally, once the customer's account has expired, banner display should also stop - and you might want to correct it by modifying the source code of the application.
Anyway, back to business. Adding phpAds to your Web site is a pretty painless process - it merely involves adding a couple of hooks to your Web pages. In order to better understand it, consider the following simple HTML page:
Now, let's suppose I want to add a banner to this page. I've got my phpAds all set up with client information and a bunch of banners. The first step, then, is to include some required files at the top of my HTML (now PHP) page.
Next, I need to use the phpAds-supplied view() function to
actually display a banner. This function takes five arguments, of which only the first one is compulsory. This first argument may be a banner ID, a keyword or image dimensions - phpAds will display a banner matching the argument specified.
In order to illustrate this, consider the following updated HTML page:
Downside? You don't want this, because it means you'll always
be stuck with the same banner on your page. And while loyalty is a nice concept, you're interested in satisfying as many customers as possible so that you can buy your own island and retire. Which is why you might prefer this: