The ASP Content Linking component is used to create a quick and easy navigation system!

The Content Linking component returns a Nextlink object that is used to hold a list of Web pages to be navigated.

Syntax

<%
Set nl=Server.CreateObject("MSWC.NextLink")
%>
 

ASP Content Linking Example

First we create a text file - "links.txt":

asp_intro.asp ASP Intro
asp_syntax.asp ASP Syntax
asp_variables.asp ASP Variables
asp_procedures.asp ASP Procedures
 

The text file above contains the pages to be navigated. The pages must be listed in the same order you want them to be displayed, and it must also contain a description for each file name (use the tab key to separate file name from description).

Note: If you want to add a page, or change the order of the pages in the list; you only have to modify the text file! The navigation will automatically be corrected!

Then we create an include file, "nlcode.inc". The .inc file creates a NextLink object to navigate between the pages listed in "links.txt".

"nlcode.inc":

<%
dim nl
Set nl=Server.CreateObject("MSWC.NextLink")
if (nl.GetListIndex("links.txt")>1) then
  Response.Write("<a href='" & nl.GetPreviousURL("links.txt"))
  Response.Write("'>Previous Page</a>")
end if
Response.Write("<a href='" & nl.GetNextURL("links.txt"))
Response.Write("'>Next Page</a>")
%>

In each of the .asp pages listed in the text file "links.txt", put one line of code: <!-- #include file="nlcode.inc"-->. This line will include the code in "nlcode.inc" on every page listed in "links.txt" and the navigation will work.



Practice Excercise Practice now