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

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

Note: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("'>Previous Page</a>")
end if
Response.Write("<a href='" & nl.GetNextURL("links.txt"))
Response.Write("'>Next Page</a>")
%>

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

ပြောက်ပြန်ချက်: နောက်ဆုံး ကြောင်းဆိုချက်: ASP သုံးမှုကို

GetNextURL စနစ်

ကမ္ဘာ့အသုံးပြီး လုံလောက်သော ဆက်သွယ်ရေး စာတမ်းများ တွင် တခါတည်း အသုံးပြီး ဖြစ်သော ဆက်သွယ်ရေး စာကြောင်းလုံး ကို မှတ်ယူပါ၏။ နောက်ဆုံး ဆက်သွယ်ရေး စာကြောင်းလုံး ကို မှတ်ယူပါ၏။

ပုဂ္ဂိုလ်

<%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink") 
c=nl.GetNextURL("links.txt") 
Response.Write("Next ")
Response.Write("URL is: ")
Response.Write(c)
%>

ပြောက်ပြန်ချက်: နောက်ဆုံး ဆက်သွယ်ရေး အမည်: asp_variables.asp

GetNthDescription စနစ်

ကမ္ဘာ့အသုံးပြီး လုံလောက်သော ဆက်သွယ်ရေး စာတမ်းများ တွင် တခါတည်း အသုံးပြီး ဖြစ်သော ဆက်သွယ်ရေး စာကြောင်းလုံး ကို မှတ်ယူပါ၏။ တတိယ စာကြောင်းလုံး ကို မှတ်ယူပါ၏။

ပုဂ္ဂိုလ်

<%
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 သုံးမှုကို

GetNthURL စနစ်

ကမ္ဘာ့အသုံးပြီး လုံလောက်သော ဆက်သွယ်ရေး စာတမ်းများ တွင် တခါတည်း အသုံးပြီး ဖြစ်သော ဆက်သွယ်ရေး စာကြောင်းလုံး ကို မှတ်ယူပါ၏။ တတိယ စာကြောင်းလုံး ကို မှတ်ယူပါ၏။

ပုဂ္ဂိုလ်

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

ပြောက်ပြန်ချက်: တတိယ ဆက်သွယ်ရေး အမည်: 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 သုံးမှုကို

GetPreviousURL စနစ်

ကမ္ဘာ့အသုံးပြီး လုံလောက်သော ဆက်သွယ်ရေး စာတမ်းများ တွင် တခါတည်း အသုံးပြီး ဖြစ်သော ဆက်သွယ်ရေး စာကြောင်းလုံး ကို မှတ်ယူပါ၏။ ပြီးတော့ စာတမ်းများ တွင် တခါတည်း မှ တွေ့မရှိခဲ့ရှိ လျှင် စာတမ်းများ အပေါ် ပထမ စာကြောင်းလုံး ကို မှတ်ယူပါ၏။

ပုဂ္ဂိုလ်

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