当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Content Linking

ASP
ASP 介绍
ASP Install
ASP 语法
ASP 变量
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream

ASP Content Linking


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 601 ::
收藏到网摘: n/a

Examples举例

The Content Linking Component
This example builds a table of contents.
Content链接组件1
这个案例建立了一个Content链接组件

The Content Linking Component 2
The example uses the Content Linking Component to navigate between the pages in a text file.
Content链接组件2
这个例子使用了Content链接组件对文本文件中的页面进行导航。


ASP Content Linking Component
ASP Content链接组件

The ASP Content Linking component is used to create a quick and easy navigation system!
ASP Content链接组件是用来建立快速而简单的导航系统的。

The Content Linking component returns a Nextlink object that is used to hold a list of Web pages to be navigated.
Content链接组件返回一个用来对页面列表进行导航的NextLink组件。

Syntax语法

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

First we create a text file - "links.txt". This file contains the pages to be navigated. The pages must be listed in the same order you want them to be displayed, and it also must 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 to the list or change the order of the pages in the list; all you have to do is to modify the text file! The navigation will automatically be correct!
首先建立一个文本文件“Links.txt”。这个文件包含了所有被导航的页面。这些页面必须按照你所希望的那样按照相同的顺序显示出来,他还必须包含每个文件名字的叙述(使用“Tab”将文件名分离)。提示:如果你希望王列表中添加页面或改变列表中的页面顺序;那么你就必须对整个文本文件进行修改!整个导航过程将会被自动正确化。

"links.txt":

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

On each of the pages listed above, put one line of code: <!-- #include file="nlcode.inc"-->. This line will include the code below on every page listed in "links.txt" and the navigation will work.
你只要在需要列表的每个页面上使用一行代码:<!-- #include file="nlcode.inc"-->,那么所有的页面都回包含下面的代码,并且导航系统也将发挥作用:

"nlcode.inc":

<%
'Use the Content Linking Component
'to navigate between the pages listed
'in links.txt
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>")
%>

The ASP Content Linking Component's methods are described below:
我们将ASP Content链接组件的使用方法描述如下:

Methods方法

Method方法 Description具体描述 Example举例
GetListCount Returns the number of items listed in the Content Linking List file
返回内容链接列表文件中被列出项目的数量
<%
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")
%>

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. 0 is returned if the current page is not in the Content Linking List file
返回内容链接文件中现有当前项目的索引数量。第一个索引项目的索引序号是1。0则是返回当前页而不是内容链接列表文件。
<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

Output:

Item number 3

GetNextDescription Returns the text description of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the last page on the list
返回内容链接列表文件的下一个项目的文字描述。如果这个当前页没有在列表文件中被发现,那么它将返回列表中最后一个文件的文字描述。
<%
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 Returns the URL of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the last page on the list
返回内容链接列表文件被列出的下一个项目的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 Returns the description of the Nth page listed in the Content Linking List file
返回内容链接列表文件中被列出的第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 Returns the URL of the Nth page listed in the Content Linking List file
返回内容链接列表文件中被列出的第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 Returns the text description of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the first page on the list
返回内容链接列表文件中的上一级项目的文字描述。如果文件中的当前页不存在,那么他将返回列表中第1页的文字描述。
<%
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 Returns the URL of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the first page on the list
返回内容链接列表文件中的上一级项目的URL。如果文件中的当前页不存在,那么他将返回列表中第1页的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

评论 (0) All

登陆 | 还没注册?