Content linking component [Asp]

Source: Internet
Author: User
Tags file url

Once we used DW for Web pages, we had such an annoyance: when we made a new page, we had to re-run the super chain for all other related pages.

. Once, I felt that I had done a lot of useless work. Imagine if there is a dedicated File responsible for page connection

How nice it is.

The content linking component came into being. Instead of creating a directory table on these pages

They establish a dynamic connection between them, and automatically generate and update the directory table and the navigation links of previous and subsequent web pages.

To use this component, you first need to write a directory file, that is, the sequential list file of the webpage URL. It is a text file and can

Free naming. Next, compile an ASP file and automatically generate a directory page with a hyperlink based on the information provided by the directory file. If you need

On each page, if the hyperchain of "turning forward or backward" is used, a file that can automatically generate a paging hyperchain can be written.

Inc is an extension, for example, "nlink. Inc ". Later, it will be included in each page of the group.

1. link.txt

redirect.asp?url=http://www.cnbruce.com/    cnbruce.com
redirect.asp?url=http://www.blueidea.com/    blueidea.com
redirect.asp?url=http://www.it365cn.com/    it365cn.com

The URL of the directory file is the link URL, and the text is the link text. Note thatTab key.

2, Link. asp

<%Set objNextLink = Server.CreateObject("MSWC.Nextlink")%>
<%
intCount = objNextLink.GetListCount("link.txt")
For i = 1 To intCount
%>
<a href="<%=objNextLink.GetNthURL("link.txt", i) %>">
<%=objNextLink.GetNthDescription("link.txt", i) %>
</a>
<br>
<%Next%>

"Set objnextlink = server. Createobject ("mswc. nextlink ")Create a connection to the nextlink component

"Objnextlink. getlistcount ("link.txt ")Number of lists extracted from the link.txt file by DIG

"Objnextlink. getnthurl ("link.txt", I)Extract the URL of line I text in the link.txt File

"Objnextlink. getnthdescription ("link.txt", I)Extract the connection text of line I in the link.txt File

3. Redirect. asp
That is, to switch to the file.

<%
Response.Clear
Response.Redirect Request.QueryString("url")
%>

Haha, do you think the "Previous Page" and "next page" functions are useless. Come back ~!

4,link1.txt

1. advanced ASP programming (1)
2. advanced ASP programming (2)
3. advanced ASP programming (3)
4. advanced ASP programming (4)

The main function is to set text and Connection

5, link1.inc

<% Set nextlink = server. Createobject ("mswc. nextlink ")
Response. write "the index number of the current article is" & nextlink. getlistindex ("link1.txt") & "<br>"
Response. write "the title of the previous chapter:" & nextlink. getpreviusdescription ("link1.txt") & "<br>"
Response. write "the title of the next chapter:" & nextlink. getnextdescription ("link1.txt") & "<br>"
Count = nextlink. getlistcount ("link1.txt ")
Response. write "<a href =" "& nextlink. getnthurl ("link1.txt", 1) & "" &> "&" Chapter 1 "&" </a>"
Response. Write "<a href =" "& nextlink. getpreviusurl (" link1.txt ") &" "&>" & "previous chapter" & "</a>"
Response. Write "<a href =" "& nextlink. getnexturl (" link1.txt ") &" "&>" & "Next Chapter" & "</a>"
Response. write "<a href =" "& nextlink. getnthurl ("link1.txt", count) & "" &> "&" last chapter "&" </a> <br>"
%>


Getlistcount (target file name) displays the number of connected files in the component.

Getlistindex (target file name) displays the index values of the current page before and after these connection files.

Getnextdescription (target file name) displays the next description in the connection file.


Getnexturl (target file name) displays the URL of the next file in the connection file.

Getnthdescription (target file name, n) displays the description of the N web pages in the connection file.






Getnthurl (target file name, n) displays the File URL address of the nth web page in the connection file.


Getnthurl (target file name, n) displays the File URL address of the nth web page in the connection file.















Getpreviusdescription (target file name) displays the description of the previous file in the connection file.

Getpreviusurl (target file name) displays the URL of the previous file in the connection file.
Related Article

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.