CHAPTER 15
Content Linking Component
Webmasters attempting to reach a wider audience often model their web sites to
fit a paradigm familiar to the site’s clients. One popular paradigm is that of a book
or a newspaper. Users unfamiliar with the web and the power of hyperlinking are
often looking for just such a paradigm to help ease them from paper-based information
to web-based information. The familiar context of a current page, previous
page, and next page is very familiar and easy to understand.
The links from page to page are simple and easy to navigate. Each page has only
a link to the previous page (if it exists) and a link to the next page (if it exists).
This simple theme has helped not only to reach a wider audience but also to
present large quantities of information, such as that in a newspaper archive, for
example.
The only problem with such a system is that maintenance, while simple, can be
extremely tedious. For example, imagine that you have four pages and decide to
remove the third, thus altering the Next link on the second page and the Previous
link on the fourth. This change is a simple one. Now, imagine you have a thousand
pages, and you must remove 90 of them from various places in the series.
Such a task would be tedious and therefore error prone, to say the least. Thankfully,
there is a better way.
Starting as an unsupported add-on, Microsoft introduced the Content Linking
component. Using the Content Linking component, you can perform maintenance
much more easily. Here’s how it works: You instantiate a NextLink object from the
Content Linking component in your ASP application. This NextLink object maintains
the current, previous, and next documents in a stream of documents by
reading each page’s entry (and its surrounding entries) from a special text file
called the Content Linking file. This file must reside in a virtual directory on your
web site and be accessible from the page containing the instantiated NextLink
object. The Content Linking file contains a list of URLs of web pages with a text
description for each page. This file is detailed in the section “Content Linking List.”
Accessory Files/Required DLL Files 287
Content Linking
Accessory Files/Required DLL Files
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Using a NextLink object and a Content Linking file, maintenance of a long list of
interlinked web pages is as simple as altering the text file. To remove a page from
the stream of web pages, you simply remove its entry from the Content Linking
file. To change a page, you simply open the Content Linking file and change the
page’s URL.
Accessory Files/Required DLL Files
Nextlink.DLL
The dynamic link library containing the Content Linking component. It must be
registered on the web server before it can be instantiated in your web
applications.
Content Linking List
The list of documents you wish to link one after another in your web site. For
each entry in this list, there is a URL, a text description for the page, and an
optional comment about the page. This file can reside anywhere on your server as
long as it is within the directory structure of a virtual root. You can assign this file
any legal filename.
Each line of the Content Linking file must match the following format:
DocumentURL [DocumentDesc [Comment]]
where each segment per line is separated by a single Tab character, and each line
is separated from the next using a single carriage return/linefeed combination. The
Content Linking Summary
Properties
None
Collections
None
Methods
GetListCount
GetListIndex
GetNextDescription
GetNextURL
GetNthDescription
GetNthURL
GetPreviousDescription
GetPreviousURL
Events
None
288 Chapter 15 – Content Linking Component
Instantiating a Content Linking Object
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
first segment, the DocumentURL, is the only required segment. This and the other
two segments are described here:
DocumentURL
A mandatory part of each content line in the list, it is a string value representing
the full virtual or relative path to the web document. You cannot use
physical paths, and you cannot use absolute URLs (those beginning with
HTTP://, //, or \\). If you do so and attempt to call one of the following
methods, an error will be raised. When filling your Content Linking list file,
ensure that each line is distinct and that you avoid any pages with a next or
previous page that references the same URL.
DocumentDesc
An optional string describing the web page pointed to by the DocumentURL
string. You can use it to display a name or other descriptive information for its
link. You cannot have a tab within the DocumentDesc segment.
Comments
An optional string commenting the web page pointed to by the DocumentURL
string. The user will not see this string, and it should be thought of only as a
way to help the webmaster maintain this file. No method of the Content
Linking component processes this segment of a line.
The following is a sample Content Linking list containing eight items:
/newinfo/headlines.asp Headlines New headline stories.
/newinfo/Page2header.htm Human Interest Variety section.
/Ad1/AdPage1.asp Advertisement Page1 First Ad Page.
/newinfo/Sports.asp Sports Sports section.
/newinfo/OpEd.asp Opinions Editor opinion.
/Ad1/AdPage1.asp Advertisement Page1 Second Ad Page.
/Class1/Class1.asp Classifieds
/Class2/Class2.asp Classifieds
Though it is hard to distinguish where each segment begins and ends, the component
looks for the Tab character. Notice that you do not have to have a comment.
Also, a page can exist in more than one place in the file, as long as a loop does
not arise from its improper placement. Finally, the document description field can
be the same for more than one page listed in the Content Linking file.
Instantiating a Content Linking Object
To create an object variable containing an instance of the Content Linking component,
use the Server object’s CreateObject method. The syntax for the CreateObject
method is as follows:
Set objMyObject = Server.CreateObject(strProgId)
where:
• The objMyObject parameter represents the name of the Content Linking
object.
• The strProgId parameter represents the programmatic ID (ProgID) of the
Content Linking component, which is MSWC.NextLink.
Comments/Troubleshooting 289
Content Linking
Comments/Troubleshooting
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Example
<%
' The following code uses the CreateObject method of the
' Server object to instantiate a Content Linking object
' on the server.
Dim objNextLink
Set objNextLink = Server.CreateObject("MSWC.NextLink")
%>
For more details on the use of the CreateObject method, see its documentation in
Chapter 8, Server Object.
Comments/Troubleshooting
Using the Content Linking component is simple. Remember to separate each field
in the Content Linking file with a tab character and each line with a single carriage
return/linefeed combination.
One excellent use of the Content Linking component that I have seen is to dynamically
generate a table of contents for your site. For example, the following code
reads the Content Linking list called MyContentList.TXT and from it generates a
table of contents. For more details about the methods used, see the following
Methods reference.
<%
' Dimension local variables.
Dim objNextLink
Dim intTotalCount
Dim intCounter
' Instantiate a NextLink object for this script.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a total count of items in the Content Linking
' file.
intTotalCount = _
objNextLink.GetListCount("/MyContentList.TXT")
' Iterate through all the items in the Content Linking
' list and generate an entry in an ordered list.
%>
<OL>
<UL>
<%
For intCounter = 1 to intTotalCount
strOutput = objNextLink.GetNthURL("/MyContentList.TXT", _
intCounter)
%>
<LI>
<!-- Create a hyperlink to the URL for the current item -->
290 Chapter 15 – Content Linking Component
Methods Reference
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
<!-- in the list. -->
<a href= "<%=strOutput%>">
<!-- Retrieve the text description for that URL. -->
objNextLink.GetNthDescription("/MyContentList.TXT", _
intCounter)
</LI>
<%
Next
%>
</UL>
</OL>
<%
' Release the memory held for the NextLink object.
Set objNextLink = Nothing
%>
Methods Reference
GetListCount
objNextLink.GetListCount(strContentLinkList)
Retrieves an integer representing the total number of entries in the Content Linking list.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<%
' Dimension local variables.
Dim objNextLink
Dim intListCount
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a count of the pages listed in the Content
' Linking list file.
intListCount = _
objNextLink.GetListCount("/Content/MyContentLinkList.txt")
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
See the full example at the end of this chapter.
GetListIndex 291
Content Linking
GetListIndex
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
GetListIndex
objNextLink.GetListIndex(strContentLinkList)
Returns an integer containing the position (starting with position 1) of the current
item in the Content Linking list. You can use this method to determine if you are
at the last item in the content linking list or whether there are more items to which
to navigate.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<HTML>
<HEAD>
<TITLE>Document List</TITLE>
<BODY>
<%
' Dimension local variables.
Dim objNextLink
Dim intCurrentPos
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a position of the current page listed in
' the Content Linking list file.
intCurrentPos = _
objNextLink.GetListIndex("/Content/MyContentLinkList.txt")
' In this instance, calling GetListIndex will return the
' number 1 if this page is in the content linking list.
' Otherwise, it will return 0.
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
...[additional code]
Notes
The return value is zero (0) if the current page is not in the Content Linking list
file.
In addition to the previous example, see the full example at the end of this
chapter.
292 Chapter 15 – Content Linking Component
GetNextDescription
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
GetNextDescription
objNextLink.GetNextDescription(strContentLinkList )
Returns a string containing the description of the next document listed in the
Content Linking list.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<HTML>
<HEAD>
<TITLE>Document List</TITLE>
<BODY>
<%
' Dimension local variables.
Dim objNextLink
Dim strNextDesc
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a description text for the next item in the
' Content Linking list file.
strNextDesc = _
objNextLink.GetNextDescription("/MyContentLinkList.txt")
' Display the next description to the client.
%>
<%= strNextDesc%>
<%
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
...[additional HTML and code]
Notes
If the current document is not listed in the Content Linking list file, the description
text for the last item in the list file is returned by default. If the current item is the
last item in the list, calling GetNextDescription returns an empty string (“”).
In addition to the previous example, see the full example at the end of this
chapter.
GetNextURL 293
Content Linking
GetNextURL
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
GetNextURL
objNextLink.GetNextURL(strContentLinkList)
Returns a string containing the URL entry of the next document listed in the
Content Linking list.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<%
' Dimension local variables.
Dim objNextLink
Dim strNextDesc
Dim strNextURL
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a description text for the next item in the
' Content Linking list file.
strNextDesc = _
objNextLink.GetNextDescription("/MyContentLinkList.txt")
' Retrieve a URL for the next item in the Content Linking
' list file.
strNextURL = _
objNextLink.GetNextURL("/MyContentLinkList.txt")
' Use strNextURL to create a link to the item whose
' description you retrieved using GetNextDescription.
%>
<A HREF = "<%= strNextURL %>"><%= strNextDesc%></A>
<%
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
...[additional HTML and code]
Notes
If the current document is not listed in the Content Linking list file, the URL text
for the last item in the list file is returned by default.
Using GetNextURL with a Content Linking file, you do not have to change the
code within your HTML to update a “NEXT PAGE” hyperlink, for example. You
294 Chapter 15 – Content Linking Component
GetNthDescription
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
have only to change the Content Linking list, and the component will automatically
update this link for you.
In addition to the previous example, see the full example at the end of this
chapter.
GetNthDescription
objNextLink.GetNthDescription(strContentLinkList, intItemIndex)
Returns a string containing the description for the item in the Nth position (on the
Nth line) in the Content Linking list.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
intItemIndex
An integer indicating the index of the item whose description you wish to
retrieve from the Content Linking list.
Example
<%
' Dimension local variables.
Dim objNextLink
Dim intTotalCount
Dim intCounter
' Instantiate a NextLink object for this script.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a total count of items in the Content Linking file.
intTotalCount = _
objNextLink.GetListCount("/MyContentList.TXT")
' Iterate through all the items in the Content Linking
' list and generate an entry in an ordered list.
%>
<OL>
<UL>
<%
For intCounter = 1 to intTotalCount
%>
<LI>
<!-- Create a hyperlink to the URL for the current item -->
<!-- in the list. -->
<a href "<%=
objNextLink.GetNthURL("/MyContentList.TXT", _
intCounter)%>">
<!-- Retrieve the text description for that URL. -->
GetNthURL 295
Content Linking
GetNthURL
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
objNextLink.GetNthDescription("/MyContentList.TXT", _
intCounter)
</LI>
<%
Next
%>
</UL>
</OL>
<%
' Release the memory held for the NextLink object.
Set objNextLink = Nothing
%>
Notes
If there is not an item in the position sent in the intItemIndex parameter, an
error results. To prevent this, you can compare the value to be supplied as the
intItemIndex argument with the value returned by a call to the GetListCount
method.
In addition to the previous example, see the full example at the end of this
chapter.
GetNthURL
objNextLink.GetNthURL(strContentLinkList, intItemIndex)
Returns a string containing the URL for the item in the Nth position (on the Nth
line) in the Content Linking list.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
intItemIndex
The index of the item in the Content Linking list whose URL you wish to
retrieve. This is an integer parameter.
Example
<%
' Dimension local variables.
Dim objNextLink
Dim intTotalCount
Dim intCounter
' Instantiate a NextLink object for this script.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a total count of items in the Content
' Linking file.
intTotalCount = _
296 Chapter 15 – Content Linking Component
GetPreviousDescription
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
objNextLink.GetListCount("/MyContentList.TXT")
' Iterate through all the items in the Content Linking
' list and generate an entry in an ordered list.
%>
<OL>
<UL>
<%
For intCounter = 1 to intTotalCount
%>
<LI>
<!-- Create a hyperlink to the URL for the current -->
<!-- item in the list. -->
<a href "<%=
objNextLink.GetNthURL("/MyContentList.TXT", _
intCounter)%>">
<!-- Retrieve the text description for that URL. -->
objNextLink.GetNthDescription("/MyContentList.TXT", _
intCounter)
</LI>
<%
Next
%>
</UL>
</OL>
<%
' Release the memory held for the NextLink object.
Set objNextLink = Nothing
%>
Notes
If there is not an item in the position indicated by the intItemIndex parameter,
an error results. To prevent this, you can compare the value to be supplied as the
intItemIndex argument with the value returned by a call to the GetListCount
method.
In addition to the previous example, see the full example at the end of this
chapter.
GetPreviousDescription
objNextLink.GetPreviousDescription(strContentLinkList )
Returns an ASCII string containing the description of the previous document listed
in the Content Linking list.
GetPreviousURL 297
Content Linking
GetPreviousURL
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<HTML>
<HEAD>
<TITLE>Document List</TITLE>
<BODY>
<%
' Dimension local variables.
Dim objNextLink
Dim strPrevDesc
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a description text for the previous item in
' the Content Linking list file.
strPrevDesc = _
objNextLink.GetPreviousDescription("/MyContentLinkList.txt")
' Display the previous description to the client.
%>
<%= strPrevDesc%>
<%
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
...[additional HTML and code]
Notes
If the current page cannot be found in the Content Linking list file, the description
text for the first item in the list file is returned by default. If the current item is the
first item in the list, calling GetPreviousDescription will return an empty string (“”).
In addition to the previous example, see the full example at the end of this
chapter.
GetPreviousURL
objNextLink.GetPreviousURL(strContentLinkList)
Returns a string containing the URL entry of the previous document listed in the
Content Linking list.
298 Chapter 15 – Content Linking Component
GetPreviousURL
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Parameters
strContentLinkList
A string value representing the virtual or relative pathname and filename of
your Content Linking file. You cannot use physical paths or absolute URLs
(those beginning with HTTP://, //, or \\) for this parameter.
Example
<%
' Dimension local variables.
Dim objNextLink
Dim strPrevDesc
Dim strPrevURL
' Create an instance of the NextLink object.
Set objNextLink = Server.CreateObject("MSWC.NextLink")
' Retrieve a description text for the previous item in
' the Content Linking list file.
strPrevDesc = _
objNextLink.GetPreviousDescription("/MyContentLinkList.txt")
' Retrieve a URL for the previous item in the Content
' Linking list file.
strPrevURL = _
objNextLink.GetPreviousURL("/MyContentLinkList.txt")
' Use strNextURL to create a link to the item whose
' description you retrieved using GetPreviousDescription.
%>
<A HREF = "<%= strPrevURL %>"><%= strPrevDesc%></A>
<%
' Free the memory consumed by the NextLink object.
Set objNextLink = Nothing
%>
...[additional HTML and code]
Notes
If the current page cannot be found in the Content Linking list file, the URL text
for the first item in the list file is returned by default.
Using GetPreviousURL with a Content Linking file, you do not have to change the
code within your HTML to update a “PREVIOUS PAGE” hyperlink, for example.
You only have to change the Content Linking list, and the component will automatically
update this link for you.
In addition to the previous example, see the full example at the end of this
chapter.
Content Linking Component Example 299
Content Linking
Content Linking Component Example
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Content Linking Component Example
The following example code demonstrates a complete Content Linking component
example in one place to illustrate the overall mechanism of the Content
Linking component and its accessory content list file.
The scenario is simple. The following set of scripts demonstrates the dynamic
construction of the first few pages of an online book introducing programming.
There are five content files (Content1.ASP through Content5.ASP). For each file,
you want to provide your users with an indicator of current page number (out of
the total number of pages), a previous-page link, and a next-page link. You know
the content files will change and pages will be inserted and removed often. This is
a good example of a programming problem in which the Content Linking component
can help.
The following script is the HTML version of the fourth page in our online book:
<HTML>
<HEAD><TITLE>Introduction to Programming: Lesson 4 Looping</
TITLE></HEAD>
<BODY>
Welcome to the Introduction to Programming, Lesson 4:
Looping.<BR>
[TEXT ABOUT LOOPING AND LOOP STRUCTURES]
<!-- Begin navigation section construction -->
<HR>
You are currently viewing page # 4 of 5.<BR>
Use the following links to navigate:<BR>
<A HREF "Content3.asp">Previous: Lesson 3 Variables</A><BR>
<A HREF "Content1.asp">Home: Lesson 1 Introduction</A><BR>
<A HREF "Content5.asp">Next: Lesson 5 Pointers</A><BR>
<!-- End navigation section construction -->
</BODY>
</HTML>
This HTML page could be easily created by hand and kept up-to-date manually
when pages are inserted and removed. However, you can see that with many
pages, such upkeep would be tedious, at best. For example, suppose we had to
insert a page (Lesson 3a: Advanced Variables) between lessons 3 and 4. To do this
manually, everything in bold in the previous example would have to be changed
by hand. If we removed the current home page and added a new one (with a
different name and description), we would have to make even more changes.
The Content Linking component can help us here. We start by creating a Content
Linking list, whose filename is ONLINE_CONTENT_LIST.TXT:
Content1.asp Lesson 1 Background
Content2.asp Lesson 2 Code Style
Content3.asp Lesson 3 Variables
Content4.asp Lesson 4 Looping
Content5.asp Lesson 5 Pointers
300 Chapter 15 – Content Linking Component
Content Linking Component Example
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
The file contains one line for each of our five content pages. Each line consists of
a filename and a file description, separated by a Tab character. We can now add
the following code to the navigation section of each page in our online book:
<!-- Begin navigation section construction -->
<HR>
<%
Dim objContentLink
Set objContentLink = Server.CreateObject("MSWC.NextLink")
' Retrieve the index of the current page.
intCurrentPageNumber = _
objContentLink.GetListIndex("ONLINE_CONTENT_LIST.TXT")
' Retrieve the total number of pages.
intTotalPageCount = _
objContentLink.GetListCount("ONLINE_CONTENT_LIST.TXT")
' Retrieve the URL for the first page in the series.
strHomeURL = _
objContentLink.GetNthURL("ONLINE_CONTENT_LIST.TXT", 1)
' Retrieve the description for the first page in the series
strHomeDesc = objContentLink.GetNthDescription( _
"ONLINE_CONTENT_LIST.TXT", 1)
' If the current page index is greater than 1 (i.e., it
' is after the home page), then retrieve information
' about the previous page.
If intCurrentPageNumber > 1 Then
' Retrieve the description for the first page in the
' series.
strPrevURL = objContentLink.GetPreviousURL( _
"ONLINE_CONTENT_LIST.TXT", 1)
' Retrieve the description for the previous page in
' the series.
strPrevDesc = objContentLink.GetPreviousDescription( _
"ONLINE_CONTENT_LIST.TXT", 1)
End If
' If the current page index is less than the total page
' count (i.e., it is before the last page), then retrieve
' information about the next page.
If intCurrentPageNumber < intTotalPageCount Then
' Retrieve the URL for the previous page in the series.
strNextURL = objContentLink.GetNextURL( _
"ONLINE_CONTENT_LIST.TXT", 1)
' Retrieve the description for the next page in the series.
strNextDesc = objContentLink.GetNextDescription( _
"ONLINE_CONTENT_LIST.TXT", 1)
Content Linking Component Example 301
Content Linking
Content Linking Component Example
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
End If
' Now use the preceding information to construct the
' navigation section of the current page.
%>
You are currently viewing page #
<%=intCurrentPageNumber%> of
<%=intTotalPageCount%>.<BR>
Use the following links to navigate:<BR>
<%If intCurrentPageNumber > 1 Then%>
<A HREF "<%=strPrevURL%>">Previous:
<%=strPrevDesc%></A><BR>
<%End If%>
<A HREF "<%=strHomeURL%>">Home: <%=strHomeDesc%></A><BR>
<%If intCurrentPageNumber < intTotalPageCount%>
<A HREF "<%=strNextURL%>">Next: <%=strNextDesc%></A><BR>
<%End If%>
<!-- End navigation section construction -->
If we were to replace the following code in bold:
<HTML>
<HEAD><TITLE>Introduction to Programming: Lesson 4 Looping</
TITLE></HEAD>
<BODY>
Welcome to the Introduction to Programming, Lesson 4:
Looping.<BR>
[TEXT ABOUT LOOPING AND LOOP STRUCTURES]
<!-- Begin navigation section construction -->
<HR>
You are currently viewing page # 4 of 5.<BR>
Use the following links to navigate:<BR>
<A HREF "Content3.asp">Previous: Lesson 3 Variables</A><BR>
<A HREF "Content1.asp">Home: Lesson 1 Introduction</A><BR>
<A HREF "Content5.asp">Next: Lesson 5 Pointers</A><BR>
<!-- End navigation section construction -->
</BODY>
</HTML>
with the Content Linking component code segment preceding it, the result would
be a navigation links section that stays current with the Content Linking list. All
you would have to do to update the links is to update the Content Linking list file.
We could even go one step further and save the previous code as an include file
(called NavConstruct.INC) and include it anywhere in the content pages for our
online book:
<HTML>
<HEAD><TITLE>Introduction to Programming: Lesson 4 Looping
</TITLE></HEAD>
302 Chapter 15 – Content Linking Component
Content Linking Component Example
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
<BODY>
Welcome to the Introduction to Programming, Lesson 4:
Looping.<BR>
[TEXT ABOUT LOOPING AND LOOP STRUCTURES]
<!-- #INCLUDE FILE = NavConstruct.INC-->
</BODY>
Now suppose we must add a page between pages 3 and 4. All that we must do,
after creating the page itself (and including our NavConstruct.INC include file), is
to update the ONLINE_CONTENT_LIST.TXT Content Linking list file:
Content1.asp Lesson 1 Background
Content2.asp Lesson 2 Code Style
Content3.asp Lesson 3 Variables
Content3a.asp Lession 3a Advanced Variables
Content4.asp Lesson 4 Looping
Content5.asp Lesson 5 Pointers
All the links constructed using the Content inking list component are updated
upon the code’s execution and the links stay correct. You can avoid the task of
going into each affected file and updating hardcoded links. It is all done for you.
303
Content Rotator
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.