एएसपी सामग्री लिंकिंग घटक
और ज्यादा उदाहरण
की एक तालिका बनाएँ।
टेक्स्ट फ़ाइल में पृष्ठों के बीच नेविगेट करने के लिए सामग्री लिंकिंग घटक का उपयोग करें।
एएसपी सामग्री लिंकिंग घटक
ASP सामग्री लिंकिंग घटक का उपयोग त्वरित और आसान नेविगेशन सिस्टम बनाने के लिए किया जाता है!
सामग्री लिंकिंग घटक एक नेक्स्टलिंक ऑब्जेक्ट देता है जिसका उपयोग नेविगेट किए जाने वाले वेब पेजों की सूची रखने के लिए किया जाता है।
वाक्य - विन्यास
<%
Set nl=Server.CreateObject("MSWC.NextLink")
%>
एएसपी सामग्री लिंकिंग उदाहरण
सबसे पहले हम एक टेक्स्ट फाइल बनाते हैं - "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 फ़ाइल "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>")
%>
टेक्स्ट फ़ाइल "links.txt" में सूचीबद्ध प्रत्येक .asp पेज में कोड की एक लाइन डालें: <!-- #include file="nlcode.inc"--> । इस लाइन में "links.txt" में सूचीबद्ध प्रत्येक पृष्ठ पर "nlcode.inc" में कोड शामिल होगा और नेविगेशन काम करेगा।
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 |