Getting Started with ASP-Content wheel Display components

Source: Internet
Author: User

The Content Rotator component is very similar to the advertisement wheel display (Ad Rotator) component, except that the content wheel display component randomly transforms the content of the page rather than just an ad image, which can be used in the following three areas:

1 Daily News: You can randomly display new information about different aspects of the site today, such as visitor status, newsgroup information, access to the user's information exchange.

2 Random connection: Randomly points and displays the content of each website.

3 Advertising display: Here, the attention is drawn to the contents of the display component can be produced than the advertising wheel display components (Ad Rotator) provided by the circular ads more sophisticated advertising system.

The steps for using the content wheel-display component are as follows:

1 Create a content wheel-display Component object instance;

2 Create the Content list file;

3 retrieves and displays the content string.

1. Create a content wheel Display component instance

The content wheel display component is included in the Controt.dll file. When using this component, you need to use the Server.CreateObject method to create a content wheel-display component (ContentRotator) object instance, which has the following syntax format:

Set oVar=Server.CreateObject("MSWC.ContentRotator")

Where the parameter oVar specifies the instance name of the content wheel-display component (ContentRotator) that is created by the Server.CreateObject method. The method does not have a registry key.

2. Create a Content list file

Use the Content Rotator component to first create a content scheduling file: Include all of the Web page content to be displayed, a plain text file that can be processed using any common text editor, and can be stored as any name and suffix. The file format is as follows:

       %%[#n[//注释]

Display content

1 The entire file consists of multiple entries, each of which consists of two parts.

2 where n indicates the frequency weight, the higher the weight, the greater the frequency of display. Its default value is 1.

3 The annotation content is optional.

4 display content refers to the content of the Web page to be displayed by the wheel.

3. Retrieve and display the content string

Content Rotator has no attributes, only two methods. The description of each method is shown in the following table:

Method Description Syntax format
ChooseContent Reads an entry in the Content scheduling file and displays it in the browser window. ChooseContent (< content arrangement File >)
GetAllContent Reads all entries in the content scheduling file, adds GetAllContent (< content arrangement File >)

4, Example 1: Design random text player.

Create a frames page (main.htm) with a left and right two frame window to display the personal home page, the corresponding file is home.asp. The right frame is a random text player, and the corresponding file is right.asp.

The code for the-------------------frames page mian.htm is as follows----------------------

    
        <frameset cols="250,*">
    <frame src="home.asp" name="left">
    <frame src="right.asp" name="right">
    </frameset>
    

----------------the code for creating a content wheel-display component file (right.asp) is as follows------------

   
   
    <body>
    <%
    Set MyContent=Server.createObject("MSWC.ContentRotator")
    Response.Write MyContent.ChooseContent("ss.txt")
    Set MyContent=nothing
    %>
    </body>
   

The contents of the-------------------Content arrangement document (Ss.txt) are as follows----------------------

    %%#2//这是条目1,用于显示一个图片形式的超链接
    <a href="http://www.163.com"></a>
    %%#2//这是条目2,用于显示两行文本,并对内容字符串设置了字体、字号和颜色
    <center><font face="楷体_GB2312" size="6" color="red">
    <p>白日依山尽,黄河入海流。</p>
    <p>欲穷千里目,更上一层楼。</p></font></center>
    %%#1//这是条目3,用于播放一个媒体文件
    <embed src="a.swf" width="500" height="450"></embed>

The file (home.asp) code shown in the-------------------left frame is as follows----------------------

   
        <body>
    <center>
   
    内容轮显组件的使用
    </center>
    </body>
   

See the full set of ASP Getting started tutorials

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.