ASP Content Linking
Component
Try It Yourself - Examples
ASP Content Linking Component
The ASP Content Linking Component is used to create a quick and convenient navigation system!
The Content Linking Component returns a Nextlink object, which is used to hold a list of web pages that need to be navigated.
Syntax
ASP Content Linking Example
First, we will create a text file - "links.txt":
This text file contains the pages that need to be navigated. The order of the pages should be the same as their display order, and include a description for each filename (use tabs to separate the filename and description).
Note: If you want to add pages to the list or change the order of pages in the list, you only need to modify this text file! The navigation will update automatically!
Then we create a reference file, "nlcode.inc". The .inc file creates a NextLink object to navigate between the pages listed in "links.txt".
"nlcode.inc":
Place the following line of code in each .asp page listed in the "links.txt" text file: <!-- #include file="nlcode.inc"-->. This line of code will reference the code in "nlcode.inc" on each page listed in "links.txt", allowing the navigation to work.
ASP Content Linking Component Methods
Method | Description | Example |
---|---|---|
GetListCount | Returns the number of items listed in the content linking list file. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetListCount("links.txt") <br>Response.Write("There are ") <br>Response.Write(c) <br>Response.Write(" items in the list") <br>%> Output: There are 4 items in the list |
GetListIndex | Returns the index number of the current item in the content linking list file. The index number of the first item is 1. If the current page is not found in the content linking list file, it returns 0. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetListIndex("links.txt") <br>Response.Write("Item number ") <br>Response.Write(c) <br>%> Output: Item number 3 |
GetNextDescription | Returns the text description of the next item listed in the content linking list file. If the current file is not found in the list file, it returns the text description of the last page in the list. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetNextDescription("links.txt") <br>Response.Write("Next ") <br>Response.Write("description is: ") <br>Response.Write(c) <br>%> Output: Next description is: ASP Variables |
GetNextURL | Returns the URL of the next item listed in the content linking list file. If the current file is not found in the list file, it returns the URL of the last page in the list. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetNextURL("links.txt") <br>Response.Write("Next ") <br>Response.Write("URL is: ") <br>Response.Write(c) <br>%> Output: Next URL is: asp_variables.asp |
GetNthDescription | Returns the description of the Nth page listed in the content linking list file. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetNthDescription("links.txt",3) <br>Response.Write("Third ") <br>Response.Write("description is: ") <br>Response.Write(c) <br>%> Output: Third description is: ASP Variables |
GetNthURL | Returns the URL of the Nth page listed in the content linking list file. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetNthURL("links.txt",3) <br>Response.Write("Third ") <br>Response.Write("URL is: ") <br>Response.Write(c) <br>%> Output: Third URL is: asp_variables.asp |
GetPreviousDescription | Returns the text description of the previous item listed in the content linking list file. If the current file is not found in the list file, it returns the text description of the first page in the list. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetPreviousDescription("links.txt") <br>Response.Write("Previous ") <br>Response.Write("description is: ") <br>Response.Write(c) <br>%> Output: Previous description is: ASP Variables |
GetPreviousURL | Returns the URL of the previous item listed in the content linking list file. If the current file is not found in the list file, it returns the URL of the first page in the list. | <% <br>dim nl,c <br>Set nl=Server.CreateObject("MSWC.NextLink") <br>c=nl.GetPreviousURL("links.txt") <br>Response.Write("Previous ") <br>Response.Write("URL is: ") <br>Response.Write(c) <br>%> Output: Previous URL is: asp_variables.asp |