Latest web development tutorials

ASP Content Linking

Examples

Try - Example

Content Linking Component
In this case to build a table of contents.

Content Linking Component 2
This example uses the Content Linking component between the pages in a text file to navigate.


ASP Content Linking Component

ASP Content Linking components for creating quick and easy navigation system!

Content Linking component returns a Nextlink object that is used to hold a list of required navigation page.

grammar

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


ASP Content Linking examples

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

asp_intro.asp ASP 简介
asp_syntax.asp ASP 语法
asp_variables.asp ASP 变量
asp_procedures.asp ASP 程序

The above text file that contains the required navigation page. Page order they should be displayed in the same order, and contains a description of each file name (use tabs to separate the file name and description).

Note: If you want to add pages to the list, or change the page order in the list, then you need to do is modify the text file it!Navigation will be updated automatically!

We then create a reference file, "nlcode.inc". .inc Files between the pages to create a NextLink object listed in the "links.txt" in navigation.

"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>")
%>

Please placed in each .asp page text file "links.txt" listed in the line ofcode: <- #include file = "nlcode.inc " -!>.This line of code references "nlcode.inc" code on every page listed in the "links.txt" in the navigation will work.


The method of ASP Content Linking component

方法 描述 实例
GetListCount 返回内容链接列表文件中所列项目的数量。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListCount("links.txt")
Response.Write("There are ")
Response.Write(c)
Response.Write(" items in the list")
%>

输出:

There are 4 items in the list

GetListIndex 返回在内容链接列表文件中当前条目的索引号。第一个条目的索引号是 1。如果当前页面不在内容链接列表文件中,则返回 0。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

输出:

Item number 3

GetNextDescription 返回在内容链接列表文件中所列的下一个条目的文本描述。如果在列表文件中没有找到当前文件,则返回列表中最后一个页面的文本描述。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextDescription("links.txt")
Response.Write("Next ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Next description is: ASP Variables

GetNextURL 返回在内容链接列表文件中所列的下一个条目的 URL。如果在列表文件中没有找到当前文件,则返回列表中最后一个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextURL("links.txt")
Response.Write("Next ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Next URL is: asp_variables.asp

GetNthDescription 返在内容链接列表文件中所列的第 N 个页面的描述信息。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthDescription("links.txt",3)
Response.Write("Third ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Third description is: ASP Variables

GetNthURL 返回在内容链接列表文件中所列的第 N 个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNthURL("links.txt",3)
Response.Write("Third ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Third URL is: asp_variables.asp

GetPreviousDescription 返回在内容链接列表文件中所列的前一个条目的文本描述。如果在列表文件中没有找到当前文件,则返回列表中第一个页面的文本描述。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousDescription("links.txt")
Response.Write("Previous ")
Response.Write("description is: ")
Response.Write(c)
%>

输出:

Previous description is: ASP Variables

GetPreviousURL 返回在内容链接列表文件中所列的前一个条目的 URL。如果在列表文件中没有找到当前文件,则返回列表中第一个页面的 URL。 <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousURL("links.txt")
Response.Write("Previous ")
Response.Write("URL is: ")
Response.Write(c)
%>

输出:

Previous URL is: asp_variables.asp