บทช่วยสอน ASP

ASP HOME

กวดวิชา WP

แนะนำหน้าเว็บ มีดโกนหน้าเว็บ เค้าโครงหน้าเว็บ โฟลเดอร์หน้าเว็บ หน้าเว็บทั่วโลก แบบฟอร์มหน้าเว็บ วัตถุหน้าเว็บ ไฟล์หน้าเว็บ ฐานข้อมูลหน้าเว็บ ผู้ช่วยหน้าเว็บ หน้าเว็บ WebGrid แผนภูมิหน้าเว็บ อีเมลหน้าเว็บ ความปลอดภัยของหน้าเว็บ เผยแพร่หน้าเว็บ ตัวอย่างหน้าเว็บ ชั้นเรียนของหน้าเว็บ

มีดโกน ASP.NET

แนะนำมีดโกน มีดโกนไวยากรณ์ มีดโกน C# ตัวแปร มีดโกน C# ลูป มีดโกน C# Logic ตัวแปรมีดโกน VB มีดโกน VB Loops มีดโกน VB Logic

ASP Classic

แนะนำ ASP ไวยากรณ์ ASP ตัวแปร ASP ขั้นตอน ASP เงื่อนไข ASP ASP วนรอบ แบบฟอร์ม ASP คุกกี้ ASP เซสชัน ASP แอปพลิเคชัน ASP ASP #รวม ASP Global.asa ASP AJAX อีเมล ASP ตัวอย่าง ASP

การอ้างอิง ASP

ฟังก์ชัน ASP VB คีย์เวิร์ด ASP VB การตอบสนอง ASP คำขอ ASP แอปพลิเคชัน ASP เซสชัน ASP เซิร์ฟเวอร์ ASP ข้อผิดพลาด ASP ASP FileSystem ASP TextStream ไดรฟ์ ASP ไฟล์ ASP โฟลเดอร์ ASP พจนานุกรม ASP ASP AdRotator ASP BrowserCap การเชื่อมโยงเนื้อหา ASP ตัวหมุนเนื้อหา ASP ASP Quick Ref

กวดวิชา ADO

แนะนำ ADO ADO Connect ชุดระเบียน ADO จอแสดงผล ADO แบบสอบถาม ADO ADO Sort เพิ่ม ADO ADO Update ADO ลบ สาธิต ADO ADO เร่งความเร็ว

วัตถุ ADO

คำสั่ง ADO การเชื่อมต่อ ADO ข้อผิดพลาด ADO ADO Field พารามิเตอร์ ADO ADO พร็อพเพอร์ตี้ บันทึก ADO ชุดระเบียน ADO ADO สตรีม ประเภทข้อมูล ADO

ส่วนประกอบการเชื่อมโยงเนื้อหา ASP


ตัวอย่างเพิ่มเติม


สร้างสารบัญ


ใช้คอมโพเนนต์การลิงก์เนื้อหาเพื่อนำทางระหว่างหน้าต่างๆ ในไฟล์ข้อความ


ส่วนประกอบการเชื่อมโยงเนื้อหา ASP

คอมโพเนนต์ ASP Content Linking ใช้เพื่อสร้างระบบนำทางที่ง่ายและรวดเร็ว!

คอมโพเนนต์การลิงก์เนื้อหาส่งคืนออบเจ็กต์ Nextlink ที่ใช้เก็บรายการเว็บเพจที่จะนำทาง

ไวยากรณ์

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

ตัวอย่างการเชื่อมโยงเนื้อหา ASP

ขั้นแรก เราสร้างไฟล์ข้อความ - "links.txt":

asp_intro.asp ASP Intro
asp_syntax.asp ASP Syntax
asp_variables.asp ASP Variables
asp_procedures.asp ASP Procedures

ไฟล์ข้อความด้านบนมีหน้าที่จะนำทาง เพจต้องอยู่ในลำดับเดียวกับที่คุณต้องการให้แสดง และต้องมีคำอธิบายสำหรับชื่อไฟล์แต่ละชื่อด้วย (ใช้ปุ่มแท็บเพื่อแยกชื่อไฟล์ออกจากคำอธิบาย)

หมายเหตุ:หากคุณต้องการเพิ่มหน้าหรือเปลี่ยนลำดับของหน้าในรายการ คุณต้องแก้ไขไฟล์ข้อความเท่านั้น! การนำทางจะได้รับการแก้ไขโดยอัตโนมัติ!

จากนั้นเราสร้างไฟล์รวม "nlcode.inc" ไฟล์ .inc สร้างอ็อบเจ็กต์ NextLink เพื่อนำทางระหว่างเพจต่างๆ ที่แสดงใน "links.txt"

"nlcode.inc":

<%
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 ที่อยู่ในไฟล์ข้อความ "links.txt" ให้ใส่โค้ดหนึ่งบรรทัด: <!-- #include file="nlcode.inc"-- > บรรทัดนี้จะรวมรหัสใน "nlcode.inc" ในทุกหน้าที่แสดงรายการใน "links.txt" และการนำทางจะทำงาน



วิธีการของคอมโพเนนต์การเชื่อมโยงเนื้อหา ASP

Method Description Example
GetListCount Returns the number of items listed in the Content Linking List file <%
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")
%>

Output:

There are 4 items in the list

GetListIndex Returns the index number of the current item in the Content Linking List file. The index number of the first item is 1. 0 is returned if the current page is not in the Content Linking List file <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetListIndex("links.txt")
Response.Write("Item number ")
Response.Write(c)
%>

Output:

Item number 3

GetNextDescription Returns the text description of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the last page on the list <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextDescription("links.txt")
Response.Write("Next ")
Response.Write("description is: ")
Response.Write(c)
%>

Next description is: ASP Variables

GetNextURL Returns the URL of the next item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the last page on the list <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetNextURL("links.txt")
Response.Write("Next ")
Response.Write("URL is: ")
Response.Write(c)
%>

Next URL is: asp_variables.asp

GetNthDescription Returns the description of the Nth page listed in the Content Linking List file <%
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)
%>

Third description is: ASP Variables

GetNthURL Returns the URL of the Nth page listed in the Content Linking List file <%
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)
%>

Third URL is: asp_variables.asp

GetPreviousDescription Returns the text description of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the text description of the first page on the list <%
dim nl,c
Set nl=Server.CreateObject("MSWC.NextLink")
c=nl.GetPreviousDescription("links.txt")
Response.Write("Previous ")
Response.Write("description is: ")
Response.Write(c)
%>

Previous description is: ASP Variables

GetPreviousURL Returns the URL of the previous item listed in the Content Linking List file. If the current page is not found in the list file it returns the URL of the first page on the list <%
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