MSWC.NextLink的使用方法

80酷酷网    80kuku.com

  mswc在源码公开中用到了 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›

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: