在源码公开中用到了 content linking 组件,目的在于通过线性排列顺序列表来管理网页和网址间的超文本链接。如果你对这种解释有疑惑,看看 这里 ,我可没有一条一条加链接哟。
源.码
第一步 内容链接顺序说明的文本文件,也就是“网页或网址的线性排列顺序文件”
( content linking list file ),看看 列表文件 。
第二步 首页内嵌程序
‹%
set mylink=server.createobject("mswc.nextlink")
file="list.txt"
count=mylink.getlistcount(file)
for i=1 to count
url=mylink.getnthurl(file,i)
description=mylink.getnthdescription(file,i)
%›
‹a href="‹%=url%›"›%=description%›‹/a›
‹% next %›s
第三步 各分页内嵌程序
‹%
set mylink=server.createobject("mswc.nextlink")
file="list.txt"
count=mylink.getlistcount(file)
if mylink.getlistindex(file)>1 then
response.write "‹a href=" & mylink.getpreviousurl(file) & ">"_
& "上一篇" & "‹/a›"
end if
if mylink.getlistindex(file)‹count-1 then
response.write "‹a href=" & mylink.getnexturl(file) & ">"_
& "下一篇" & "‹/a›"
end if
response.write "‹a href=" & mylink.getnthurl(file,count) & ">"_
& "源码首页" & "‹/a›"
%›
说.明
content linking list file 格式分为三列,列与列之间必须以 [tab] 分隔。
网页或网址的 url [描述文字[附加说明]]
网页或网址的 url 参数表示所要链接的网页或网址,相对、绝对路径都可以。
描述文字参数是显示给用户的说明文字。
附加说明参数不会显示给用户,注解而已。
content linking 组件是 asp 内置的重要组件,建立组件的语法为:
set objectname=server.createobject("mswc.nextlink")
content linking 的组件方法说明
方 法 格 式 说 明
getlistcount int = getlistcount ( *.txt ) 页面个数
getlistindex int = getlistindex ( *.txt ) 当前页面的顺序值
getnthurl string = getnthurl ( *.txt , i ) 指定位置页面的地址
getnthdescription string = getnthdescription ( *.txt , i ) 指定位置页面的描述
getnexturl string = getnexturl ( *.txt ) 下一个页面的地址
getnextdescription string = getnextdescription ( *.txt ) 下一个页面的描述
getpreviousurl string = gepreviousturl ( *.txt ) 上一个页面的地址
getpreviousdescription string = getpreviousdescription ( *.txt ) 上一个页面的描述
注.意
1 列表文件中记录的排列顺序,注意这个程序是将首页位置放在最后,循环起始和次数就会
因此不同。
2 getnthurl 和 getnthdescription 方法是取得指定位置页面的地址或描述,首页是显示
所有记录,所以用了循环函数。
3 你是否注意 ie 浏览窗口中标题的描述是页面的主题呢?声明,我是很懒的人,不会逐条
的链接。这里用到了 getlistindex 和 getnthdescription 方法,对照上表中方法的说
明你就会明白。
‹%
list=mylink.getlistindex(file)
title=mylink.getnthdescription(file,list)
%›
‹title›‹% =title %›‹/title›
