iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (35)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

July 20, 2008
Wiki: A Solution to the Web Design Problem
About
 
July 19, 2008
Plurk or Twitter: Which one is Better?
About
 
July 19, 2008
Top 10 Social Networking Sites
About
 
July 19, 2008
Create Menus with Lists and CSS
About
 
July 17, 2008
Poll: What do you do when you can't design?
About
 
July 17, 2008
22 Reasons to Plurk
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /ASP.NET

Using Built-In ASP Components 

  Views:    9499
  Votes:    0
by Andrew Schools 4/06/04 Rating: 

Synopsis:

In this tutorial, we will be working with three of Microsoft's built-in ASP components. The Ad Rotator, Content Linker and the Browser Capabilities Component.
Pages: firstback1 3 forwardlast
The Article

Using the Content Linker Component

What's the Content Linker Component? It's used to manage large, frequently updated sites which have tutorials, etc. To use the Content Linker Component, you will need a text file to create a linking list file.

webpageURL   description   comment  

Each line can contain up to three tab-separated items, like above.

webpageURL is the page you want to link to. Use file names only, URLS that begin with Http:// won't work.

description is a description of the page.

comment is used as a comment for programmers.

So let's create a linking list file:

linkinglistfile.txt

tut_fun.asp   Functions   my functions page

tut_com.asp   Components   my components page

tut_inc.asp   Includes   my includes page  

Now we need to create our ASP page that will display our pages from our linking list file.

index.asp

<HTML><HEAD>

<TITLE>MY TUTORIALS SECTION</TITLE>

</HEAD><BODY>

Starting ASP<BR>

Welcome to my tutorial selection for programming in asp! Start by clicking on one of the links below...<br>

<%

Dim objLinker

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

Response.Write "<P><A HREF='" & objLinker.GetPreviousURL("linkinglistfile.txt") & "'>" & objLinker.GetPreviousDescription("linkinglistfile.txt") & "</A>" & " " & "<A HREF='" & objLinker.GetNextURL("linkinglistfile.txt") & "'>" & objLinker.GetNextDescription("linkinglistfile.txt") & "</A></P>"

Set objLinker = Nothing

%>

</BODY></HTML> 

The only code we need to review is the following:

<%

Dim objLinker

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

Response.Write "<P><A HREF='" & objLinker.GetPreviousURL("linkinglistfile.txt") & "'>" & objLinker.GetPreviousDescription("linkinglistfile.txt") & "</A>" & " " & "<A HREF='" & objLinker.GetNextURL("linkinglistfile.txt") & "'>" & objLinker.GetNextDescription("linkinglistfile.txt") & "</A></P>"

Set objLinker = Nothing

%>

The code above creates a previous and next link for us. In order for us to accomplish this, we must use the methods GetPreviousURL(), GetPreviousDescription(), GetNextURL() and GetNextDescription() of the NextLink object. They are self explanatory.

Remember to include the code above in all the pages you plan on linking. For instance, tut_fun.asp, tut_com.asp and tut_inc.asp would all have the code above at the bottom of their pages, however, different content.

There are also other methods the NextLink object takes:

GetListCount(listfile) - returns the number of pages the linking list file contains

GetListIndex(listfile) - returns the index number of the current page in linking list file

GetNthURL(listfile, num) - returns the URL of the num page in the linking list file

GetNthDescription(listfile, num) - returns the description of the num page in the linking list file

Using the GetNthURL() and GetNthDescription() methods, we can make a table of contents:

<HTML><HEAD>

<TITLE>MY TUTORIALS SECTION</TITLE>

</HEAD><BODY>

Table of Contents<BR>

<%

Dim objLinker, icount, ipage

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

ipages = objLinker.GetListCount("linkinglistfile.txt")

For icount = 1 to ipages

Response.Write "<A HREF='" & objLinker.GetNthURL("linkinglistfile.txt", icount) & "'>" & objLinker.GetNthDescription("linkinglistfile.txt", icount) & "</A><BR>"

Next
%>

The code above will give us a table of contents using a For...Next Loop with a GetNthURL() and GetNthDescription() method.

Pages: firstback1 3 forwardlast

Similar/related articles:


 
  Sponsors