Ad Rotator Example

The following code demonstrates a complete Ad Rotator example to illustrate the overall mechanism of the Ad Rotator and its accessory files.

The first file, SampleHome.ASP, is the originally requested page containing the ad component. After the ad component retrieves it from the rotator schedule, this page also contains the ad.

<% ' +------------------------------------+ ' | SAMPLEHOME.ASP | ' +------------------------------------+ %> <HTML> <HEAD><TITLE>Ad Rotator Sample</TITLE></HEAD> <BODY BGCOLOR = #ffffcc> <% ' Dimension local variables. Dim adrotSample Dim strAdRotSchedFile Dim strAdString Set adrotSample = Server.CreateObject("MSWC.AdRotator") ' Set the ad to have no border. adrotSample.Border = 0 ' Set the ad so that its corresponding URL is loaded ' into a second, blank browser window. adrotSample.TargetFrame = "_blank" ' No need to set the Clickable property to True. It is ' the default. If we wanted to temporarily change this ' page's ad so that it was informational only, we ' could uncomment the next line. 'adrotSample.Clickable = False ' Retrieve the ad graphic html code (in this case it ' will be "/ads/graphics/FootTown.gif" with a URL of ' "http://www.foottownusa.com/info/introshoes.html." ' (See the sample rotator schedule file for more ' details on this ad.) strAdRotSchedFile = "/ads/rotshed.txt" strAdString = adrotSample.GetAdvertisement(strAdRotSchedFile) %> <HR> <%= strAdString%> <HR> Welcome to the shoes outlet page. Please visit our sponsors ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.