HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
The ASP Content Rotator component creates a ContentRotator object that displays adifferent content string each time a visitor enters or refreshes a page
The ASP Content Rotator component creates a ContentRotator object that displays a different content string each time a visitor enters or refreshes a page.
A text file, called the Content Schedule File, includes the information about the content strings.
The content strings can contain HTML tags so you can display any type of content that HTML can represent: text, images, colors, or hyperlinks.
Syntax
The following example displays a different content each time a visitor views the Web page.
First, create a text file named "textads.txt" and place it in a subfolder called "text".
"textads.txt":
Notice the #number at the beginning of each content string. This number is an optional parameter that indicates the relative weight of the HTML content string. In the text file above, the Content Rotator will display the first and second content string three-tenth of the time, and the third string four-tenths of the time.
Then, create an ASP file, and insert the following code:
<html>
<body>
<%
set cr=server.createobject("MSWC.ContentRotator")
response.write(cr.ChooseContent("text/textads.txt"))
%>
</body>
</html>
Method | Description | Example |
---|---|---|
ChooseContent | Gets and displays a content string | <% dim cr Set cr=Server.CreateObject("MSWC.ContentRotator") response.write(cr.ChooseContent("text/textads.txt")) %> Output: |
GetAllContent | Retrieves and displays all of the content strings in the text file | <% dim cr Set cr=Server.CreateObject("MSWC.ContentRotator") response.write(cr.GetAllContent("text/textads.txt")) %> Output: This is a great day!! |