Microsoft KB Archive/318285

= HOW TO: Use the ASP Ad Rotator Installable Component in FrontPage 2002 =

Article ID: 318285

Article Last Modified on 6/29/2007

-

APPLIES TO


 * Microsoft FrontPage 2002 Standard Edition

-



This article was previously published under Q318285





For a Microsoft FrontPage 2000 version of this article, see 312402.

IN THIS TASK
SUMMARY
 * Creating a Rotator Schedule File
 * Creating a Redirection Page
 * Creating the Ad Rotator Component
 * Inserting the Ad Rotator on the Page
 * Saving and Previewing the Page

MORE INFORMATION
 * What are Installable Components?
 * Rotator Schedule File Syntax

REFERENCES



SUMMARY
This article describes how to use the Ad Rotator installable component for Active Server Pages (ASP) in Microsoft FrontPage.

NOTE: You may receive an error message if you copy the examples directly from this article and paste them into FrontPage. The angle brackets may appear as escaped HTML code. To work around this behavior, paste the script into a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

(Back to top)

Creating a Rotator Schedule File
A rotator schedule file is a specialized list of advertisements to display. A double percentage sign denotes the separation of each advertisement section and a double slash indicates a comment.

For additional information, see the Rotator Schedule File Syntax section later in this article. For additional information about the formatting you can use in this file, see the References section later in this article.  Start FrontPage. Open a Web on a Web server based on Microsoft Internet Information Services (IIS). On the Standard toolbar, click the New Page button. Click the HTML tab at the bottom of the FrontPage window to switch to HTML view. On the Edit menu, click Select All. Press DELETE to delete all of the existing text.  Type the following text: REDIRECT redir.asp WIDTH 200 HEIGHT 100 BORDER 1 http://www.microsoft.com/library/homepage/images/mslogo-blue.gif http://www.microsoft.com/ Click here for advertisement #1 1 http://msimg.com/w/logo.gif http://www.msn.com/ Click here for advertisement #2 1 http://www.msnbc.com/i/cov/b.gif http://www.msnbc.com/ Click here for advertisement #3 1                    On the File menu, click Save.</li> In the Save as type list, click All Files (*.*).</li> In the File name box, type AdRotator.txt and then click Save.</li> On the File menu, click Close.</li></ol>

(Back to top)

Creating a Redirection Page
Although a redirection file is not necessary, it allows you to track a customer's actions. For example, you can create a database to log how many times a specific advertisement is selected. To do this, perform the following steps: <ol> On the Standard toolbar, click the New Page button.</li> Click the HTML tab at the bottom of the FrontPage window to switch to HTML view.</li> On the Edit menu, click Select All. Press DELETE to delete all of the existing text.</li>  Type the following text: <%@Language=&quot;VBScript&quot;%> <%Response.Redirect(Request(&quot;URL&quot;))%> </li> On the File menu, click Save.</li> In the Save as type list, click All Files (*.*).</li> In the File name box, type redir.asp and then click Save.</li> On the File menu, click Close.</li></ol>

(Back to top)

Creating the Ad Rotator Component
<ol> On the Standard toolbar, click the New Page button.</li> Click the HTML tab at the bottom of the FrontPage window to switch to HTML View.</li>  Insert the following code before the opening   tag: <% Dim objAdRotator Set objAdRotator = Server.CreateObject(&quot;MSWC.AdRotator&quot;) %> This code creates the Ad Rotator component you will use later. </li> Click the Normal tab at the bottom of the FrontPage window to switch to Normal view.</li></ol>

(Back to top)

Inserting the Ad Rotator Component on the Page
<ol> Insert an HTML Markup Web component and then add the ASP code that uses the ad rotator object. To do this, perform the following steps: <ul> <li><ol style="list-style-type: lower-alpha;"> <li>On the Insert menu, click Web Component.</li> <li>In the Component type list, click Advanced Controls.</li> <li>In the Choose a control list, click HTML.</li> <li>Click Finish.</li></ol> </li></ul> </li> <li> In the HTML Markup dialog box, type the following code: <%=objAdRotator.GetAdvertisement(&quot;AdRotator.txt&quot;)%> This ASP code retrieves a text entry from the rotator schedule file you created earlier. </li> <li>Click OK to close the HTML Markup dialog box.</li></ol>

(Back to top)

Saving and Previewing the Page

 * 1) On the File menu, click Save.
 * 2) In the File Name box, type AdRotatorTest.asp and then click Save.
 * 3) On the File menu, click Preview in Browser.
 * 4) Click Preview.
 * 5) Preview the page in your Web browser.

When you refresh the page in the Web browser, the advertisement changes.

(Back to top)

What are Installable Components?
You can create dynamic, interactive Web pages by using the components included with Active Server Pages (ASP) in your scripts. Two built-in components are Response and Request objects. Installable components also are included with IIS.

(Back to top)

Rotator Schedule File Syntax
NOTE: The syntax for this file is rather specialized, but easy to customize. The general format for this file is shown in the following table: <pre class="fixed_text">  Line   Value 1      Value 2    Description 1     REDIRECT     [URL]      Specifies the path to the .asp file that implements redirection.

2     WIDTH        [Number]   Width of the advertisement on the page, in pixels. The default is 440 pixels.

3     HEIGHT       [Number]   Height of the advertisement on the page, in pixels. The default is 60 pixels.

4     BORDER       [Number]   Width of the hyperlink border around the advertisement, in pixels. The default is                                 a 1-pixel border.

5 *                           Signifies the end of the global information section.

A1    [Image URL]             The URL location of advertiser A's image file.

A2    [Page URL]              The URL location of advertiser A's home page.

A3    [Text]                  Alternate text that is displayed if the browser does not support graphics.

A4    [Number]                A number between 0 and 10000 that indicates the relative weight of                                  advertisement A.

B1    [Image URL]             The URL location of advertiser B's image file.

B2    [Page URL]              The URL location of advertiser B's home page.

B3    [Text]                  Alternate text that is displayed if the browser does not support graphics.

B4    [Number]                A number between 0 and 10000 that indicates the relative weight of                                  advertisement B.

To add additional advertisements, add the four lines that define an advertisement: Image URL, Page URL, Alternate Text, and Relative Weight. For additional information, see the References section later in this article.

(Back to top)

<div class="references_section">