องค์ประกอบ Content Linking ASP
- หน้าก่อนหน้า ASP BrowserCap
- หน้าต่อไป ASP ContentRotator
ตัวอย่าง
- Component Content Linking
- ตัวอย่างนี้จะทำลิสต์ความเกี่ยวข้อง
- Component Content Linking 2
- ตัวอย่างนี้ใช้ Component Content Linking ในการเนวิเกชั่นระหว่างหน้าที่ระบุในไฟล์ข้อความ
องค์ประกอบ Content Linking ASP
Component Content Linking ของ ASP ใช้สร้างระบบเนวิเกชั่นที่ง่ายต่อการใช้งาน
Component Content Linking จะกลับมาให้ Nextlink Object ซึ่งใช้เก็บลิสต์ของหน้าที่ต้องการเข้าถึง
วิธีการใช้งาน
<% 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 Introduction asp_syntax.asp ASP Syntax asp_variables.asp ASP Variable asp_procedures.asp ASP Program
Please place this line of code in the pages listed 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 Component หรือเรียกว่าเมธอด
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) %>
ออกเสียง:}}
เลขที่ 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) %>
ออกเสียง: คำอธิบาย URL ต่อไปคือ: แปรเปลี่ยน ASP
วิธีการ 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) %>
ออกเสียง: คำอธิบาย URL ที่สามคือ: แปรเปลี่ยน ASP
วิธีการ 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) %>
ออกเสียง: คำอธิบาย URL ก่อนหน้านี้คือ: แปรเปลี่ยน ASP
วิธีการ 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
- หน้าก่อนหน้า ASP BrowserCap
- หน้าต่อไป ASP ContentRotator