ສາຍວິທະຍາ ASP Content Linking Component

实例

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

ສາຍວິທະຍາ ASP Content Linking Component

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

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

语法

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

首先,我们会创建文本文件 - "links.txt"。此文件包含需要导航的页面的相关信息。页面的排列顺序应该与它们的显示顺序相同,并包含对每个文件的描述(使用制表符来分隔文件名和描述信息)。

Notes:If you want to add file information to the list or change the order of pages in the list, all you need to do is modify this text file! Then the navigation system will update automatically!

"links.txt":

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

Please place this line of code in the listed pages above: <!-- #include file="nlcode.inc"--> This line of code will list each page that references the following code in "links.txt", so navigation can work.

"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("'>ບໍລິເວນອີ້ນດ້ານໜ້າ</a>")
end if
Response.Write("<a href='" & nl.GetNextURL("links.txt"))
Response.Write("'>ບໍລິເວນອີ້ນດ້ານຫລັງ</a>")
%>

ASP Content Linking 组件的方法

GetListCount 方法

ການຫຼົງຄະແນນບັນທຶກທີ່ຢູ່ໃນບັນທຶກລາຍການຊ່ວງຖານຈຳນວນທີ່ຢູ່ໃນລາຍການ:

<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink") 
c=nl.GetListCount("links.txt") 
Response.Write("ມີ ")
Response.Write(c)
Response.Write(" ເລື່ອງໃນລາຍການ")
%>

ການສະແດງ:}}

ມີ 4 ເລື່ອງໃນລາຍການ

GetListIndex 方法

ການຫຼົງຄະແນນບັນທຶກທີ່ຢູ່ໃນບັນທຶກລາຍການຊ່ວງຖານມັນຈຳນວນ 1. ຖ້າຫົວໜ້າປະຈຸບັນບໍ່ຢູ່ໃນບັນທຶກລາຍການຊ່ວງຖານຈຳນວນ 0.

ຕົວຢ່າງ

<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink") 
c=nl.GetListIndex("links.txt") 
Response.Write("ຈຳນວນບັນທຶກ ")
Response.Write(c)
%>

ການສະແດງ:}}

ຈຳນວນວັດຖຸ 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)
%>

ການສະແດງ: ການຫຼົງສາຍຄຳອະທິບາຍ ທີໜ້ານີ້ ມີ: 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)
%>

ການສະແດງ: URL ທີໜ້ານີ້ ມີ: 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)
%>

ການສະແດງ: ການຫຼົງສາຍຄຳອະທິບາຍ ທີສາມ ມີ: ASP Variables

ການຫຼົງສາຍ GetNthURL

ການຫຼົງສາຍ URL ຂອງໜ້າທີ N ໃນບັນທຶກການເຊື່ອມຕໍ່ທາງຄວາມ.

ຕົວຢ່າງ

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

ການສະແດງ: URL ທີສາມ ມີ: 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)
%>

ການສະແດງ: ການຫຼົງສາຍຄຳອະທິບາຍແມ່ນ: 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)
%>

ອອກສະພາບ: URL ກ່ອນໄປແມ່ນ: asp_variables.asp