The Content Rotator component automates the rotation of the specified content on a Web page. Each time you open or reload a Web page, new content based on the information specified in the Content Rotator Schedule file is displayed. One common application of this component is the Thought for the Day section on a Web page. Whenever you access a Web page, a different 'Thought' appears.
The ContentRotator Schedule file contains information used by the Content Rotator component for managing and displaying the specified content. In this file you can include several content strings.
Each entry consists of two sections:
The syntax of the ContentRotator Schedule file is:
%% [#Weight] [//Comments] ContentString
For example, if a Content Rotator Schedule file contains three content strings with weights set to 4, 7, and 9, the first string has a probability of 20 percent, the second has 35 percent, and the third has 45 percent. By default the weight will be set to 1.
NOTE:If the sum of all weight values exceeds 10000, an error will be generated when the schedule file is accessed by a call to either the GetAllContent or ChooseContent methods.
The following is a sample Content Rotator Schedule file to display a variety of content.
CONTROT.TXT %% #2 // The weight is 5. Everything is connected. %% #2 // Content can be more than one line long %% // Note that HTML tags are used in this content <FONT FACE="ARIAL,HELVETICA" SIZE="2"> Look before you <H1>leap</H1>. </FONT> %% #5 Smile like <Font Face ="Terbuchet,Tahoma" Size="4"> <a href=images/smile.gif>me</a> </Font>
Automates the rotation of content on a Web page.
Gets the content string from the Content Rotator Schedule file and displays it on the Web page.
object.ChooseContent( ContentScheduleFilePath As String)
String. This is a set of HTML tags required by the browser to display the next content.
The content is chosen randomly. The probability is defined by the Weight value specified in the Content Rotator Schedule file. See Syntax for details.
This example displays the Thought for the Day.
<% ’Displays Thought for the Day.
Set Thought = CreateObject("MSWC.ContentRotator") %>
<% =Thought.ChooseContent("controt.txt") %>
Gets all the content strings from the Content Rotator Schedule File and displays them on the Web page as a list with horizontal rule (<HR>) as separator.
object.GetAllContent( ContentScheduleFilePath As String)
Null.
This example displays all content of the Thought For The Day file
<% ’Displays all content of the Thought For The Day file.
Set Thought = CreateObject("MSWC.ContentRotator")
Thought.GetAllContent("controt.txt") %>