Easy Tutorial
❮ Asp Ref Filesystem Asp Applications ❯

ASP Content Rotator Component (ASP 3.0)


ASP Content Rotator Component

The ASP Content Rotator component creates a ContentRotator object that displays a different content string each time a visitor enters the website or refreshes the page.

Information about the content strings is contained in a text file called the Content Schedule File.

Content strings can include HTML tags, allowing you to display any type of content that HTML can render: text, images, colors, or hyperlinks.

Syntax


ASP Content Rotator Example

The following example displays different content each time a visitor views the webpage.

First, create a text file named "textads.txt" and place it in a subfolder named "text".

"textads.txt":

Note the # number at the beginning of each content string. This number is an optional parameter used to indicate the relative weight of the HTML content string. In the above text file, the Content Rotator has a 30% chance of displaying the first content string, a 30% chance of displaying the second content string, and a 40% chance of displaying the third string.

Then, create an ASP file and insert the following code:

Example


ASP Content Rotator Component Methods

Method Description Example
ChooseContent Retrieves and displays a content string. <% <br>dim cr <br>Set cr=Server.CreateObject("MSWC.ContentRotator") <br>response.write(cr.ChooseContent("text/textads.txt")) <br>%> Output:
GetAllContent Retrieves and displays all content strings in the text file. <% <br>dim cr <br>Set cr=Server.CreateObject("MSWC.ContentRotator") <br>response.write(cr.GetAllContent("text/textads.txt")) <br>%> Output: This is a great day!! Visit tutorialpro
❮ Asp Ref Filesystem Asp Applications ❯