Sideway
output.to from Sideway
Draft for Information Only

Content

ASP Server Components
  Content Rotator component
    File Name
    Syntax
    Parameters
    Remark
   ContRot.ChooseContent Method
    Syntax
    Parameters
    Return Values
   ContRot.GetAllContent Method
    Syntax
    Parameters
    Return Values
   Content Schedule File
    Syntax
    Parameters
   Examples

ASP Server Components

Some of the ASP server components are the common features found in dynamic web pages. These base ASP server components are provided to enrich the pre-made functions of ASP technology for making dynamic and interactive web pages. However, some IIS pre-made components are not installed for all version of IIS. Ad Rotator, Browser Capabilities, Content Linker, Content Rotator, Counters, Logging Utility, My Info, Page Counter, Status, and tools are not installed with IIS 6.0. However, if you upgrade your Web server from a previous version of IIS, the pre-made components are not removed. Some IIS pre-made components, ASP content rotator and nextlink,  are deprecated in IIS7. And most IIS pre-made components are either not installed with IIS7 or their usage is not supported.

Content Rotator component

The Content Rotator component can be used to create a ContentRotator object that acts as a HTML tags holder on an ASP page for controlling the rotation of HTML content strings to be displayed on a web page automatically. The function of the ContentRotator object is to automate the displaying of HTML content strings on the web page each time when an user opens or reloads the web page. A text file called Content Schedule File is used to store the information for controlling the way of the  HTML content strings to be displaced on the web page. Since the HTML content strings can be texts or HTML tags, any type of content can be displayed by the ContentRotator object through HTML tags, e.g. text, images, or hyperlinks, even style control. Therefore a ContentRotator object can be used to rotate the content of a web page through a list of content items, hyperlinks, or style properties each time when the web page is opened or reloaded by the user.

In addition to the Content Schedule file, the Content Rotator Component uses a random generator to select which of the weighted content strings is displayed, therefore a HTML content string may be repeated especially when there is only a few entries in the Content Schedule file, or one of the entries in the Content Schedule file is weighted much higher than the others.

File Name

The file name of the Content Rotator component is Controt.dll.

Syntax

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

Parameters

ContRotName

The parameter "ContRotName" is the name assigned to the instance of the ContentRotator object created by the call using the Server.CreateObject.

Remark

The Content Rotator component does not work with Internet Information Server 7 (IIS7).

ContRot.ChooseContent Method

ContRot.ChooseContent method is used to retrieve the HTML content string from the Content Linking List file and response the HTML content string on the current ASP page. The script "ContRot.ChooseContent" runs each time when a user opens or reload the page, and the ContRot.ChooseContent method will retrieve a new random scheduled HTML content string each time.

Syntax

ContRotName.ChooseContent( content-schedule-path )

Parameters

ContRotName

The parameter "ContRotName" is the name of the instance of the ContentRotator object to be set.

content-schedule-path

The parameter "content-schedule-path" is used to specify the location of the Content Schedule file. The path parameter can be specified by either using a relative or virtual path. The ContentRotator object will call the Server.MapPath method to map the specified path to the physical directory of the Content Schedule file.

Return Values

The ContRot.ChooseContent method returns an HTML content string from the Content Schedule file.

ContRot.GetAllContent Method

ContRot.GetAllContent method is used to retrieve all of the HTML content strings from the Content Linking List file and response all HTML content strings on the current ASP page as a list with an <HR> tag after each entry. The script "ContRot.GetAllContent" is usually used to proofread all the HTML content strings in the Content Schedule file.

Syntax

ContRotName.ChooseGetAllContent( content-schedule-path )

Parameters

ContRotName

The parameter "ContRotName" is the name of the instance of the ContentRotator object to be set.

content-schedule-path

The parameter "content-schedule-path" is used to specify the location of the Content Schedule file. The path parameter can be specified by either using a relative or virtual path. The ContentRotator object will call the Server.MapPath method to map the specified path to the physical directory of the Content Schedule file.

Return Values

The ContRot.ChooseContent method returns all HTML content strings from the Content Schedule file and a HTML tag <HR> is added between two entries before strings are responsed to the ASP web page.

Content Schedule File

The Content Schedule File is used to store the specification details of the display schedule and scheduled entries of HTML content string in a collection for the Content Rotator component. There can be any number of HTML content string entries in the file. Each entry is divided into two parts. The first part is lines that begins with double percentage sings (%%) and is used for specifying the optional parameters, relative weight and comments. The second part is the HTML content string. Each line ends in a carriage return.

The Content Linking List File should be stored under the web server directory so that the Content Linking List File can be accessed through a virtual path. For the optional parameters in the first part,  a hash (#) character at the beginning of wording is used as the indicator of an weighting item while double slash (//) characters at the beginning of wording is used as the indicator of an comments item.

The change in a Content Linking List File may need to restart the IIS services in ordered to make the changes become effective.

Syntax

((%% [#Weight] [//comments])+
ContentString)+

Parameters

[...]

The parameter "[" & "]" is the indicator of the bracketed parameters by a pair of square brackets "[...]" is an optional item unless other specified.

(...)+

The parameter "+" is the indicator of the bracketed property parameters by a pair of brackets "(...)" can be repeated one or more times.

Weight

The optional parameter "Weight" is used to specify the individual relative weight of the HTML content string entry. Although a number between 0 and 10000 can be used for indicating the individual relative weight of the banner image, there is a limitation that the sum of the Weights for all entries cannot exceed 10000, otherwise an error will be generated when the Content Schedule file is called by the GetAllContent or ChooseContent method. The number 10000 is only the maximum total number of Weights for all entries in the collection. The weighting mechanism for the probability of display is expressed as the ratio of the individual weight of an item over the total number of Weights for all items in the Content Schedule file. For example, if a Content Schedule file contains three entries with weights set to 1, 3, and 4, the first content is displayed 12.5 percent of the time, the second 37.5 percent of the time, and the third 50 percent of the time. if the Weight is not specified, a default value 1 is assigned to the content. But a Weight of 0 will cause the entry of the content to be ignored by the ContentRotator object.

comments

The optional parameter "comment" is used to specify the comments about the content entry. The comment is for reference only and will not be displayed to the user. Multi-line comment is supported by repeating a line begins with the double percentage sings (%%) line delimiter and followed by the double slash (//) of a comment indicator

ContentString

The parameter "ContentString" is used to specify the HTML content string to be displayed by  ContentRotator object. The HTML content string can be used to present text, image, or hyperlink, ...etc. Multi-line ContentString is supported. More than one lines of HTML content string can be entered because the ContentRotator object treats all lines between two line blocks with double percent signs (%%) as one single HTML content string entry. 

Examples

  • Example of making use of ContentRotator object to display HTML content string in a web page.

    ASP Page, Nextlink.asp:

    <%
    Set cr = Server.CreateObject("MSWC.ContentRotator")
    %>
    Displace one scheduled content:<br />
    <%
    Response.Write cr.ChooseContent("ContRotSch.txt")
    %><br /><br />
    Displace the whole list of scheduled content:<br />
    <%
    Response.Write cr.GetAllContent("ContRotSch.txt")
    %>

    HTTP response ouput:
    Displace one scheduled content:<br />
    <img src="../images/sideway.jpg" />
     <br /><br />
    Displace the whole list of scheduled content:<br />
     
    <hr>
     
    Output.to Sideway.
     
    <hr>
     
    <h1>Heading 1</h1>
     
    <hr>
     
    <img src="../images/sideway.jpg" />
     
    <hr>
     
    Here's the <a href="output.to">Home Page</a>.
    <hr>
  • Example of Content Schedule File

    Text in the Content Schedule File, ContRotSch.txt:

    %% // Using the default value 1 for the Weight.
    Output.to Sideway.
     
    %% #2 // line 1 comment.
    %% // line 2 comment.
    <h1>Heading 1</h1>

    %% #3 // This is the Sideway image.
    <img src="../images/sideway.jpg" />
     
    %%
    Here's the <a href="http://output.to">Home Page</a>.


©sideway

ID: 130200007 Last Updated: 14/2/2013 Revision: 0 Ref:

close

References

  1. Active Server Pages,  
  2. ASP Overview,  
  3. ASP Best Practices,  
  4. ASP Built-in Objects,  
  5. Response Object,  
  6. Request Object,  
  7. Server Object (IIS),  
  8. Application Object (IIS),  
  9. Session Object (IIS),  
  10. ASPError Object,  
  11. ObjectContext Object (IIS),  
  12. Debugging Global.asa Files,  
  13. How to: Debug Global.asa files,  
  14. Calling COM Components from ASP Pages,  
  15. IIS ASP Scripting Reference,  
  16. ASP Keywords,  
  17. Creating Simple ASP Pages,  
  18. Including Files in ASP Applications,  
  19. ASP Overview,  
  20. FileSystemObject Object,  
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  
  22. ADO Fundamentals,  
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 7

Culture

Chinese 1097

English 337

Reference 67

Computer

Hardware 149

Software

Application 187

Digitization 24

Numeric 19

Programming

Web 757

CSS 1

ASP.NET 1

Regular Expression 1

HTML

Knowledge Base

Common Color 1

Html Entity (Unicode) 1

Html 401 Special 1

OS 389

MS Windows

Windows10 1

.NET Framework 1

DeskTop 7

Knowledge

Mathematics

Formulas 8

Algebra 20

Number Theory 206

Trigonometry 18

Geometry 18

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Physics

Electric 10

Biology 1

Geography 1


Copyright © 2000-2019 Sideway . All rights reserved Disclaimers last modified on 06 September 2019