6.2.6 Content Rotator Component
The Content Rotator component, like a simplified Ad Rotator component, needs to provide a contents dispatch file. The file is only a text file that contains text segments and HTML code snippets, and the Content Rotator component automatically displays one of them on the page. A dispatch table file can include any number of text content entries, and can specify ratios to control how often each entry in a returned page is displayed.
1. Content Dispatch File
The structure of the content progress file is simpler than the Ad Rotator dispatch file, which simply provides a list of the individual text strings to be used, as indicated by a statement line preceded by a two percent sign (%). To set the rate of each entry (which determines how often it appears on the return page), add a number after the double percent semicolon, and then add a comment with a pair of forward slash characters (//). Such as:
% 3//This is the the entry of the schedule text file
For more information, mail us at
<a Href=mailto:feedback@wrox.com>wrox press</a>
% 4//this is a multi-line text string
<UL>
<LI> Language Primers
<LI> Advanced Programming
<LI> Internet Applications
</UL>
%% 2
Visit us on the <a href= "world/' >http://www.wrox.com" >world Wide
This example illustrates the three text strings that can be used in a Web page, with ratios of 3, 4, and 2, so entries will appear at 3/9, 4/9, and 2/9 frequencies. Note (as with the Ad Rotator component) the actual occurrence of each string is random, and then the corresponding ratio is corrected, and if the page is transferred nine times, this result may not happen.
2. Members of the Content Rotator component
The Content Rotator component provides only two methods for retrieving contents from a content dispatch file, as shown in table 6-5:
Table 6-5 Content Rotator Component Method and description
Method
Description
GetAllContent (Schdule_file)
Retrieve and display all strings in the Schdule_file file
ChooseContent (Schdule_file)
Retrieves (but does not show) the next appropriate content string from the Schdule_file file
3. Using the Content Rotator component
To obtain text and HTML for a specified segment from a dispatch file, you can use the ChooseContent method of the object to retrieve an entry, according to the rate specified in the content dispatch file. You can use the Response.Write method to insert it into the output stream sent to the guest room.
<% ' in VBScript:
Set objmycontent = Server.CreateObject ("MSWC. ContentRotator ")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service