Include files are used to store information that will be used by more than one ASP or HTML file. By creating an Ad Rotator Include file, when changes need to be made to specific information, you only need to change the information in one location. This lesson will guide you in creating an Ad Rotator Include file containing a function named getAd(). This function randomly selects ads to display on your ASP pages. You can call this file from within any ASP page intended to display the rotated ads. When you test calling the Include file from an ASP page
Open a new file in your text editor, paste in the following script, and save the file as Adrotatorlogic.inc
<% Function getAd()
Dim load
'Create an instance of the AdRotator component
Set load=Server.CreateObject("MSWC.AdRotator")
'Set the target frame, if any. This is the frame
'where the URL will open up. If the HTML page does
'not find the target name, the URL will be opened
'in a new window. load.
TargetFrame = "Target = new"
'Get a random advertisement from the text file.
getAd = load.GetAdvertisement("adimagedata.txt")
End Function %>
Open a new file in your text editor, paste in the following script, and save the file as Adrotatorlogic.inc
<% Function getAd()
Dim load
'Create an instance of the AdRotator component
Set load=Server.CreateObject("MSWC.AdRotator")
'Set the target frame, if any. This is the frame
'where the URL will open up. If the HTML page does
'not find the target name, the URL will be opened
'in a new window. load.
TargetFrame = "Target = new"
'Get a random advertisement from the text file.
getAd = load.GetAdvertisement("adimagedata.txt")
End Function %>
No comments:
Post a Comment