Content Rotator

Overview

This example demonstrates how you can use the Content Rotator component to create dynamic, informative applications. Content Rotator allows you to develop a Web page that displays a new HTML content string each time the page is accessed by a client browser.

Code Tour

This script first calls Server.CreateObject to create an instance of the ContentRotator object. The ChooseContent method of the ContentRotator object is then used to extract one content string from the content schedule file.

This sample's schedule file, tiprot.txt, illustrates how easy it is to create a schedule file for the Content Rotator component. Basically, each entry is separated from the other entries by entry delimiters, %%. Comments, on lines with %% followed by // can explain any additional information required about an entry, and a relative weight, denoted by the # sign, can be assigned to each entry. For instance, if you assign the first entry a weight of 4, and a the second entry a weight of 6, the first entry will be displayed for the visiting client browser for 40 percent of the hits on that page, and the second entry will be displayed for 60 percent of the hits.

Any string valid in HTML is valid in the schedule file. Thus, this example shows an unformatted text string, a formatted HTML string, and an <IMG> element pointing to a .gif file. Note that you could also include hyperlinks, tables, or anything else that makes up a Web page.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\components\ContentRotator_VBScript.asp and ...\asp\components\ContentRotator_JScript.asp.