非常教程

ASP参考手册

ASP Content Linking

ASP Content Linking

ASP Content Linking 组件


ASP Content Linking

尝试一下 - 实例

Content Linking 组件
本例构建一个内容列表。

Content Linking 组件 2
本例使用 Content Linking 组件在一个文本文件所列的页面间进行导航。


ASP Content Linking 组件

ASP Content Linking 组件用于创建快捷便利的导航系统!

Content Linking 组件会返回一个 Nextlink 对象,这个对象用于容纳需要导航网页的一个列表。

语法

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


ASP Content Linking 实例

首先,我们会创建一个文本文件 - "links.txt":

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

上面的文本文件包含需要导航的页面。页面的排列顺序应该与它们的显示顺序相同,并包含对每个文件名的描述(使用制表符来分隔文件名和描述信息)。

注释:如果您希望向列表添加页面,或者改变在列表中的页面顺序,那么您需要做的仅仅是修改这个文本文件而已!导航会自动更新!

然后我们创建一个引用文件,"nlcode.inc"。.inc 文件创建一个 NextLink 对象来在 "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>")
%>

请在文本文件 "links.txt" 列出的每个 .asp 页面中放置一行代码:<!-- #include file="nlcode.inc"-->。这行代码会在 "links.txt" 中列出每个页面上引用 "nlcode.inc" 中的代码,这样导航就可以工作了。


ASP Content Linking 组件的方法

方法 描述 实例
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


ASP Content Linking

ASP目录

1.ASP 简介
2.ASP 教程
3.在自己的 PC 上运行 ASP
4.ASP Session 对象
5.ASP Cookies
6.ASP 表单
7.ASP 程序
8.ASP 变量
9.ASP 语法
10.ASP Session 对象
11.ASP Application 对象
12.ASP Request 对象
13.ASP Response 对象
14.ASP 使用 CDOSYS 发送电子邮件
15.ASP Global.asa
16.ASP 引用文件
17.ASP Application 对象
18.ASP ASPError 对象
19.ASP Server 对象
20.ASP FileSystem 对象
21.ASP ADO
22.ASP Dictionary 对象
23.ASP Folder 对象
24.ASP File 对象
25.ASP Drive 对象
26.ASP TextStream 对象
27.ASP Content Linking
28.ASP Browser Capabilities
29.ASP AdRotator
30.ASP 实例
31.ASP 总结
32.ASP 快速参考
33.AJAX 数据库
34.ASP – AJAX 与 ASP
35.ASP Charset 属性
36.ASP CacheControl 属性
37.ASP Buffer 属性
38.ASP Cookies 集合
39.ASP Clear 方法
40.ASP BinaryWrite 方法
41.ASP AppendToLog 方法
42.ASP AddHeader 方法
43.ASP Status 属性
44.ASP Pics 属性
45.ASP IsClientConnected 属性
46.ASP ExpiresAbsolute 属性
47.ASP Expires 属性
48.ASP ContentType 属性
49.ASP BinaryRead 方法
50.ASP TotalBytes 属性
51.ASP ServerVariables 集合
52.ASP QueryString 集合
53.ASP Form 集合
54.ASP Cookies 集合
55.ASP Write 方法
56.ASP Redirect 方法
57.ASP Flush 方法
58.ASP End 方法
59.ASP LCID 属性
60.ASP CodePage 属性
61.ASP StaticObjects 集合
62.ASP Contents 集合
63.ASP Application_OnStart 和 Application_OnEnd 事件
64.ASP Lock 和 Unlock 方法
65.ASP Contents.RemoveAll 方法
66.ASP Contents.Remove 方法
67.ASP StaticObjects 集合
68.ASP Contents 集合
69.ASP GetLastError 方法
70.ASP Execute 方法
71.ASP CreateObject 方法
72.ASP ScriptTimeout 属性
73.ASP Session_OnStart 和 Session_OnEnd 事件
74.ASP Contents.RemoveAll 方法
75.ASP Contents.Remove 方法
76.ASP Abandon 方法
77.ASP Timeout 属性
78.ASP SessionID 属性
79.ASP CreateFolder 方法
80.ASP CopyFolder 方法
81.ASP CopyFile 方法
82.ASP BuildPath 方法
83.ASP Drives 属性
84.ASP ASPError 对象的属性
85.ASP URLEncode 方法
86.ASP Transfer 方法
87.ASP MapPath 方法
88.ASP HTMLEncode 方法
89.ASP GetDriveName 方法
90.ASP GetDrive 方法
91.ASP GetBaseName 方法
92.ASP GetAbsolutePathName 方法
93.ASP FolderExists 方法
94.ASP FileExists 方法
95.ASP DriveExists 方法
96.ASP DeleteFolder 方法
97.ASP DeleteFile 方法
98.ASP CreateTextFile 方法
99.ASP OpenTextFile 方法
100.ASP MoveFolder 方法