Rotating Banner Management System
ASP comes with a ready to use 'Ad Rotator' component. We can use this
to create a rotating banner management system. All we need are the following
3 files.
Call this file banner_ad.asp
The purpose of this file is to display the random advertisement.
<%
dim varad, objAd
Set objAd = Server.CreateObject("MSWC.AdRotator")
objAd.TargetFrame="TARGET=_BLANK"
varAd = objAd.GetAdvertisement("adrotator.txt")
Response.Write varAd
%>
Call this next file redirect.asp
Once the user clicks on one of the banners an associated url is
sent through the querystring to this page. This file will then
redirect the user to the url passed.
<%
response.redirect Request.querystring("url")
%>
The third file is Adrotator.txt
As you can see from the file extension this is a text file which
we can break down into 2 parts.
The first part holds general information with 4 parameters, namely
the width of the borders, the height and width of the banners
and the page that will act as the redirection page ( the page
that will be sent the url through the querystring ).
In our case this will be redirect.asp which is in the same folder.
Next we have a * which separates the parts. Dont forget it.
In part2 we have the image source, this can be relative or absolute,
the url to be sent to when the user clicks the url, the alternate
text and the frequency of the advertisement in terms of percentage.
Just note that below the url's may be the same, though for your
purposes you can simply change them.
REDIRECT redirect.asp
border 0
height 60
width 468
*
http://www.codefixer.com/advertising/BANNER1.gif
http://www.codefixer.com
Resources and Tutorials for the ASP developer
40
http://www.codefixer.com/advertising/BANNER2.gif
http://www.codefixer.com
The best ASP site on the net
50
http://www.codefixer.com/advertising/BANNER3.gif
http://www.codefixer.com
ASP for the beginner to intermediate ASP developer
10
You could use an include file to call banner_ad.asp
Make sure the folder advertising is in the root web directory
of your site when you call the file, you can then include this
in any file on your site.
<!--#include virtual="/advertising/banner_ad.asp"-->
Download the source files - advertising.zip
Here's a tip on improving this system click
here.
Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.
|