ASP 3.0 advanced programming (24)

Source: Internet
Author: User
(1) create a content page
We have used the Content Linking component to create a menu page for the examples provided in this chapter. The page default.htm in the chapter06folder uses the above code to create a menu, as shown in Figure 6-2:
Figure 6-2 menu page created by using the Content Linking component
We can see that the content of the content link list file is displayed below the link. We use the FileSystemObject object to complete this work.
<%
'Create an instance of a FileSystemObject object
Set objFSO = Server. CreateObject ("Scripting. FileSystemObject ")
'Open the text file as a TextStream object
Set objTStream = objFSO. OpenTextFile (Server. MapPath ("contlink.txt"), ForReading)
Response. Write objTStream. Readall' read the whole file and put into page
ObjTStream. Close
%>
If you edit the contlink.txt file, the menu entry changes when you call this page again. Note the last three entries in the file. These three entries use the redirect. asp technology described earlier to insert absolute (rather than relative) URLs to the list.
(2) browse these pages
When you create a Content Linking component instance and use its method, the URL of the current page matches the entries in the specified Content link list file. You can not only use this component to create a content list (as you just saw), but also use this component to navigate each page in the list when you open a page in a browser.
This means you can use hyperlinks or buttons to move one of these pages to another. For example, you can add the Next and Back buttons to the page. You can use the GetNextURL and getpreviusurl methods to know which page in the list is the previous one and which page is the Next one. On the other hand, you can use the GetNthURL method to jump to any page in the list and use the GetListIndex method to know the position of the current page in the list.
Below is a piece of code for adding the Next and Back buttons to the page. All we need to do is to put this program on each page listed in the content link file, or use the # include command of SSI to insert it into it.
<! -- Need a form to force Navigator to display the buttons -->
<Form action = "">
<%
'We' ll insert this into each page using an SSI # include statement
'Create an instance of the Content Linking component
Set objNextLink = Server. CreateObject ("MSWC. NextLink ")
'Set the content linking list file path and name
StrListFile = "contlink.txt"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.