Open Directory Site ASP Tutorials

ASP | XML | VBScript | JavaScript | ADO | CSS | XMLDOM | PHP | Operating Systems

Home >> ASP >> ASP Content Rotator (ASP 3.0)

ASP Content Rotator (ASP 3.0)

 

Content Rotator

The Content Rotator component creates a ContentRotator object that displays a different HTML content string each time a user enters or refreshes a page. A text file includes information about the content string. The content strings can contain HTML tags.

Syntax

<% Set cr = Server.CreateObject( "MSWC.ContentRotator" ) response.write(cr.ChooseContent("sometextfile.txt") %>

Methods

Method Description

ChooseContent(text_file) Gets and displays a content string

GetAllContent(text_file) Retrieves and displays all the content strings in the text file

Examples

1. The Content Rotator Component

This component displays a different HTML content string each time a user visits or refreshes the page.

Coding

<html>

<body>

<p>

If this example gives an error, ASP 3.0 is not installed on the server.

</p>

<%

set cr=server.createobject("MSWC.ContentRotator")

response.write(cr.ChooseContent("text/textads.txt"))

%>

<p>

NOTE: Because the content strings are changed randomly in the text file, and this page has only four content strings to choose from, sometimes the page will display the same content strings twice in a row.

</p>

<p>

<a href="text/textads.txt"><img border="0" src="../images/btn_view_text.gif"></a>

</p>

</body>

</html>

Output

If this example gives an error, ASP 3.0 is not installed on the server.

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/asp/demo_contentrotator.asp, line 9

Invalid class string

 

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting