# Content Rotator Component

The Content Rotator component creates a ContentRotator object that automatically rotates HTML content strings on a Web page. Each time a user requests the Web page, the object displays a new HTML content string based upon information that you specify in a Content Schedule File.

Because the content strings can contain HTML tags, you can display any type of content that HTML can represent: text, images, or hyperlinks. For example, you can use this component to rotate through a list of daily quotations or hyperlinks, or to change text and background colors each time the Web page is opened.

The following files are used by the Content Rotator component:

File Name | Description
Controt.dll | The Content Rotator component.
Content Schedule File | A text file that contains the display schedule and file information for Web content. This file must be available on a Web server virtual path.

###### Syntax

Set ContRot = Server.CreateObject( "MSWC.ContentRotator" )

###### Parameters

ContRot
  Specifies the name of the ContentRotator object created by the call to Server.CreateObject.

###### Methods

ChooseContent | Retrieves and displays a content string.
GetAllContent | Retrieves and displays all the content strings in the Content Schedule file.

Note

Because the Content Rotator Component uses a random generator to select which of the weighted content strings is displayed, a string may be repeated. This is most likely to occur if there are few entries in the Content Schedule file, or if one entry is weighted much higher than the others.

###### Example

The following example displays a different tip of the day each time a user views the Web page. To run this example, you need to create the Content Schedule File in your Default Web Site folder, in a subfolder called Data. For example, if your Default Web Site is mapped to C:\Inetpub\Wwwroot, you need to create the list file in C:\Inetpub\Wwwroot\Data\ContRot.txt.

--- ContRot.asp ---

    <%
      Set objContRot = Server.CreateObject("MSWC.ContentRotator")
    %>
    <%= objContRot.ChooseContent("/Data/ContRot.txt") %>

© 1997-2001 Microsoft Corporation. All rights reserved.