12.5 NextLink

The NextLink component manages a list of URLs. This enables you to use the pages in a Web site in the order you prefer, like the pages in a book. You can use the Content Linking component to automatically generate and update tables of contents and navigational links to previous and subsequent Web pages. This is ideal for applications such as online newspapers and forum message listings.

This component references a Content Linking List file that contains the list of the linked Web pages. This list is stored on the Web server.

12.5.1 Content Linking List File

Content Linking List file is a text file that contains a list of Web pages in the order in which they should be displayed. This file must be available on the Web server. It contains one line of text for each URL in the list. Each line contains the URL and a description, and ends with a carriage return. A TAB character separates each item on a line.

Syntax

 Web-page-URL [text-description [,comment]]
 

Parameters

Web-page-URL
The virtual or relative URL of the Web page in the format filename or directory\filename. Absolute URLs, those that start with "http:", "//", or "\\", are not supported and will not be processed by methods such as GetNextURL method and GetListIndex method. When building the content path, you should ensure that no collisions or infinite loops occur.
Text-description
A text string that describes Web-page-URL.
Comment
Explanatory string that is not processed by the component.

Example

 NEXTLINK.TXT
 news1.htm News headlines
 news2.htm City news
 news3.htm Sports
 news4.htm Legislature news 
 news5.htm Editorial 
 

12.5.2 Object Diagram

Describes  the hierarchy of various objects in the NextLink component

12.5.3 NextLink Object

Manages a list of URLs so that you can use the pages in the Web site like the pages in a book.

12.5.4 GetListCount method

Retrieves the total number of Web pages listed in the Content Linking List File located on the server.

Syntax

 object.GetListCount(
   ListURL As String)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.

Return Values

Integer.

Example

This example gives the number of entries in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
   count = NextLink.GetListCount ("/data/nextlink.txt")  
 print count %> 
 

12.5.5 GetListIndex method

Retrieves the index number of the current page in the list file. The current page is the page that loads the NextLink object.

Syntax

 object.GetListIndex(
    ListURL As String)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.

Return Values

Integer.

Remarks

Returns an integer index value specifying the position of the current page in the list file. The index number of the first item is 1. If the current page is not listed, it returns 0. If the current page is listed more than once, then the function returns the index of its first occurrence. Subsequent entries are ignored.

Example

This example gives the index of the current page.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
   index = NextLink.GetListIndex ("/data/nextlink.txt")  
 print index %> 
 

12.5.6 GetNextDescription method

Retrieves the text description of the next item in the Content Linking List File.

Syntax

 object.GetNextDescription(
    ListURL As String)
 

Parameters

ListURL
Specifies the relative path of the list file.

Return Values

String. An ASCII string describing the next item in the list file.

Remarks

If the current page is not listed, it returns a description of the last page. If the current page is the last item, it returns a description of the first item.

Example

This example gives the description of the next entry in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 Nextdes = NextLink.GetNextDescription ("/data/nextlink.txt")  
 print Nextdes %> 
 

12.5.7 GetNextURL method

Retrieves the URL of the next page with respect to the current page.

Syntax

 object.GetNextURL(
    ListURL As String)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.

Return Values

String. URL of the next item in the list file.

Remarks

If the current page is not listed, it returns the URL of the last page. If the current page is the last item, it returns the URL of the first item.

Example

This example gives the next URL in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 NextURL = NextLink.GetNextURL ("/data/nextlink.txt")  
 print NextURL %> 
 

12.5.8 GetNthDescription method

Retrieves a text description of the Nth item, defined by the index parameter.

Syntax

 object.GetNthDescrition(
    ListURL As Sting,
    Index As Integer)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.
Index
Index number of an item in the list file.

Return Values

String.

Remarks

If index is greater than the number of pages, it returns a description of the first item. If the index is 0, it returns a description of the last item. If the index is a negative number, it returns a description of the first item.

Example

This example gives the description of the third entry in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 NthDes = NextLink.GetNthDescription ("/data/nextlink.txt", 3)  
 print NthDes %> 
 

12.5.9 GetNthURL method

Returns the URL of the Nth item in the list file.

Syntax

 object.GetNthURL(
    ListURL As Sting,
    Index As Integer)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.
Index
Index number of an item in the list file.

Return Values

String.

Remarks

If index is greater than the number of pages, it returns the URL of the first item. If the index is 0, it returns the URL of the last item. If the index is a negative number, it returns the URL of the first item.

Example

This example gives the URL specified in the 5th entry in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 NthURL = NextLink.GetNthURL ("/data/nextlink.txt", 5)  
 print NthURL %>
 

12.5.10 GetPreviousDescription method

Returns the text description of the previous page with respect to the current page.

Syntax

 object.GetPreviousDescription(
    ListURL As Sting)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.

Return Values

String. Text describing the previous item in the list file.

Remarks

If the current page is not listed, it returns the description of the first page. If the current page is the first item, it returns the description of the last item.

Example

This example gives the description of the previous entry with respect to the current one in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 Des = NextLink.GetPreviousDescription ("/data/nextlink.txt")  
 print Des %>
 

12.5.11 GetPreviousURL method

Returns the URL of the previous page with respect to the current page.

Syntax

 object.GetPreviousURL(
    ListURL As Sting)
 

Parameters

ListURL
Specifies the relative path of the Content Linking List File.

Return Values

String. URL of the previous page.

Remarks

If the current page is not listed, it returns the URL of the first page. If the current page is the first item, it returns the URL of the last item.

Example

This example gives the URL of the previous entry with respect to the current one in the list file.

 <% Set NextLink = CreateObject ("MSWC.NextLink") 
 URL = NextLink.GetPreviousURL ("/data/nextlink.txt")  
 print URL %>