Open Directory Site ASP Tutorials

ASP | XML | VBScript | JavaScript | ADO | CSS | XMLDOM | PHP | Operating Systems

Home >> ASP >> ASP Content Linking

ASP Content Linking

 

Content Linking

The Content Linking component creates a Nextlink object that holds a list of linked Web pages. This component generates and updates tables of contents and navigational links. It is ideal for online newspapers and forum message listings. A text file, stored on the server, contains the list of the linked pages.

Syntax

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

Methods

Method Description

GetListCount(text_file) Counts the number of items linked in the text file

GetListIndex(text_file) Gets the index of the current page in the text file

GetNextDescription(text_file) Gets the description of the next page listed in the text

file

GetNextURL(text_file) Gets the URL of the next page listed in the text file

GetNthDescription(text_file, number) Gets the description of the Nth page listed in the text

file

GetNthURL(text_file, number) Gets the URL of the Nth page listed in the text file

GetPreviousDescription(text_file) Gets the description line of the previous page listed in

the text file

GetPreviousURL(text_file) Gets the URL of the previous pages listed in the text file

Examples

1. The Content Linking Component

This example builds a table of contents.

Coding

<html>

<body>

<p>

The example below builds a table of contents.

</p>

<%

dim c

dim i

set nl=server.createobject("MSWC.Nextlink")

c = nl.GetListCount("text\links.txt")

i = 1

%>

<ul>

<%do while (i <= c) %>

<li><a href="<%=nl.GetNthURL("text\links.txt", i)%>">

<%=nl.GetNthDescription("text\links.txt", i)%></a>

<%

i = (i + 1)

loop

%>

</ul>

<p>

The text file contains a list of page urls

and link descriptions. It contains one line of text for each page. Note that the url and

description MUST be

seperated by the TAB character.

</p>

<p>

<a href="text/links.txt"><img border="0" src="../images/btn_view_text.gif"></a>

</p>

</body>

</html>

Output

The example below builds a table of contents.

· Introduction to ASP

· The Basic Syntax Rules

· Asp Variables

· ASP Procedures

The text file contains a list of page urls and link descriptions. It contains one line of text for each page. Note that the url and description MUST be seperated by the TAB character.

View Text file

asp_intro.asp Introduction to ASP

asp_syntax.asp The Basic Syntax Rules

asp_variables.asp Asp Variables

asp_procedures.asp ASP Procedures

2. The Content Linking Component 2

The example uses the Content Linking Component to navigate between the pages in a text file.

Coding

<html>

<body>

<h1>

This is page 1!

</h1>

<%

Set nl=Server.CreateObject("MSWC.NextLink")

If (nl.GetListIndex("text/links2.txt")>1) Then

%>

<a href="

<%Response.Write(nl.GetPreviousURL("text/links2.txt"))%>

">Previous Page</a>

<%End If%>

<a href="

<%Response.Write(nl.GetNextURL("text/links2.txt"))%>

">Next Page</a>

<p>The example uses the Content Linking Component

to navigate between the pages in a text file.</p>

<p>

<a href="text/links2.txt"><img border="0" src="../images/btn_view_text.gif"></a>

</p>

</body>

</html>

Output

This is page 1!

Next Page

The example uses the Content Linking Component to navigate between the pages in a text file.

View Text File

demo_contentlinking2.asp Page 1

page2.asp Page 2

page3.asp Page 3

 

Cheap Web Hosting Articles - Web Site Design & Web Hosting Tutorials - Domain Hosting