# Content Linking Component

The Content Linking component creates a Nextlink object that manages a list of URLs so that you can treat the pages in your Web site 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.

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

###### File Names

Nextlink.dll | The Content Linking component
Content Linking List File | 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 a Web server virtual path.

###### Syntax

Set NextLink = Server.CreateObject( "MSWC.NextLink" )

###### Parameters

NextLink
  Specifies the name of the object created by the call to Server.CreateObject.

###### Methods

GetListCount | Counts the number of items linked in the Content Linking List file.
GetListIndex | Gets the index of the current page in the Content Linking List file.
GetNextDescription | Gets the description of the next page listed in the Content Linking List file.
GetNextURL | Gets the URL of the next page listed in the Content Linking List file.
GetNthDescription | Gets the description of the Nth page listed in the Content Linking List file.
GetNthURL | Gets the URL of the Nth page listed in the Content Linking List file.
GetPreviousDescription | Gets the description line of the previous page listed in the Content Linking List file.
GetPreviousURL | Gets the URL of the previous pages listed in the Content Linking List file.

###### Example

    The following example builds a table of contents. To run this example, you need to create the Content Linking List File in your Default Web Site folder, in a subfolder called Data.  For example, if your Default Web Site is mapped to C:\Inetpub\Wwwroot, you need to create the list file in C:\Inetpub\Wwwroot\Data\NextLink.txt.

--- NextLink.asp ---

    <%
       Set NextLink = Server.CreateObject("MSWC.NextLink")
       ListFile = "/data/nextlink.txt"
       count = NextLink.GetListCount(ListFile)
       I = 1
    %>
    <UL>
    <% Do While (I <= count) %>
         <LI>
         <A HREF="<%=NextLink.GetNthURL(ListFile, I)%>">
         <%= NextLink.GetNthDescription(ListFile, I) %>
         </A>
         </LI>
         <% I = (I + 1) %>
    <% Loop %>
    </UL>
    <!-- #include FILE = "nextlink.inc" -->

The following script adds next-page and previous-page links to any ASP file. Include this file in every file listed in your Content Linking List File using the following line:

<!-- #include FILE = "nextlink.inc" -->

--- NextLink.inc ---

    <BR>
    <%
       Set NextLink = Server.CreateObject ("MSWC.NextLink")
       ListFile = "/data/nextlink.txt"
       Index = NextLink.GetListIndex(ListFile)
    %>

    <TABLE BORDER=0 CELLPADDING=6>
    <TR><TD>

    <% If (Index > 1) Then %>
         <A HREF="<%=NextLink.GetPreviousURL(ListFile)%>">
         Previous Page
         </A>
    <% Else %>
         Previous Page
    <% End If %>

    </TD><TD>

    <% If 0 = Index Then %>
         <A HREF="<%=NextLink.GetNthURL(ListFile, 1)%>">
         Next Page
         </A>
    <% ElseIf (Index < NextLink.GetListCount(ListFile)) Then %>
         <A HREF="<%=NextLink.GetNextURL(ListFile)%>">
         Next Page
         </A>
    <% Else %>
         Next Page
    <% End If %>

    </TD><TD>

    <% If Not 0 = Index Then %>
         <A HREF="nextlink.asp">
         Back to Table of Contents
         </A>
    <% End If %>

    </TD></TR>
    </TABLE>

© 1997-2001 Microsoft Corporation. All rights reserved.