Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Content Linker: Listbox of contents
     [next Lesson]  File Objects: Read Directory

Content Linker Enhanced w/Library by Charles Carroll

The Microsoft Content Linker component, see:
http://www.learnasp.com/iishelp/iis/htm/asp/comp7pmc.htm
allows you to use an ASCII file that can be used to setup previous-next page style presentations. I like it so much I created a whole top-level library to simplify using it.

Here is a sample of the library being used:

   filename=/learn/contentlinker/toc_test.asp

<Test Script Below>


<!--#include file="lib_toc_v4.asp"-->
<%
' The Below Code is used to Test The Library if in doubt
Call TOCpretty("/learn/learn.toc")
' Call TOC2Joust("/learn/learn.toc")
' Call TOC2Joust("/asplists/asplists.toc")
' x Call TOC2ColumnTable("/learn/learn.toc")
' Call TOCGrabSection("/learn/learn.toc","core.asp")
' Call TOCGrabSectionPretty("/learn/learn.toc","core.asp")
' Call TOCGrabSectionLimit("/learn/learn.toc","core.asp",6)
' Call TOCGrabSectionRandom("/learn/learn.toc","core.asp")
' Call TOCGrabSectionRandomLimit("/learn/learn.toc","core.asp",4)
' Call TOCList("/learn/learn.toc","/library/jump.asp")
' response.write TOCPageType("/learn/core.asp")
' response.write TOCPageType("/learn/dbtable.asp")
' Call TOCSection2ListBox("/learn/learn.toc","core.asp")
%>

The Include file lib_toc_formats.asp looks like this:

   filename=/learn/contentlinker/lib_toc_formats.asp

<Test Script Below>


<%
SELECT CASE lcase(parmformat)
CASE "2coltoc"
    pad="&nbsp;&nbsp;&nbsp;&nbsp;"
    leftcell="<td bgcolor='#99CCFF'>"
    rightcell="<td bgcolor='#CCCCFF'>"
    linklook="<strong><B>%%linkhref%%</strong></b>"
    
    L1format="<tr>" & leftcell & linklook & "<td></tr>"
    L2format="<tr><td>" & pad & "%%linkhref%%</td></tr>"
    L1eformat="<tr>" & rightcell & linklook & "<td></tr>"
    
    TOCprefix="<table cols='1' border='1' width='50%'>"    
    TOCsuffix="</table>"
CASE "joust"
   q = chr(34)
   linebreak=vbcrlf ' & "<br>"
   
   TOCprefix="<script language='JavaScript'>" & linebreak
   TOCprefix=TOCprefix & "function initialise() {" & linebreak
   TOCprefix=TOCprefix & "// Tell joust where to find the various index files it needs" & linebreak
   TOCprefix=TOCprefix & "index1 = ""index.htm"";" & linebreak
   TOCprefix=TOCprefix & "index2 = ""index2.htm"";" & linebreak
   TOCprefix=TOCprefix & "index3 = ""index3.htm"";"    & linebreak
   TOCprefix=TOCprefix & "theBrowser.hasDHTML=false;" & linebreak
   TOCprefix=TOCprefix & "// Set up parameters to control menu behaviour" & linebreak
   TOCprefix=TOCprefix & "theMenu.autoScrolling = true;" & linebreak
   TOCprefix=TOCprefix & "theMenu.modalFolders = false;" & linebreak
   TOCprefix=TOCprefix & "theMenu.linkOnExpand = false;" & linebreak
   TOCprefix=TOCprefix & "theMenu.toggleOnLink = false;" & linebreak
   TOCprefix=TOCprefix & "theMenu.showAllAsLinks = false;" & linebreak
    TOCprefix=TOCprefix & "theMenu.focusOnLink = true;" & linebreak
   TOCprefix=TOCprefix & "theMenu.savePage = true;" & linebreak
   TOCprefix=TOCprefix & "theMenu.tipText = ""status"";" & linebreak
   TOCprefix=TOCprefix & "theMenu.name = ""theMenu"";" & linebreak
   TOCprefix=TOCprefix & "theMenu.container = ""self.menu"";" & linebreak
   TOCprefix=TOCprefix & "theMenu.reverseRef = ""parent"";" & linebreak
   TOCprefix=TOCprefix & "theMenu.contentFrame = 'text';" & linebreak
   TOCprefix=TOCprefix & "theMenu.defaultTarget = 'text';" & linebreak
   TOCprefix=TOCprefix & "// Initialise all the icons" & linebreak
   TOCprefix=TOCprefix & "initOutlineIcons(theMenu.imgStore);" & linebreak
   TOCprefix=TOCprefix & "// Now set up the menu with a whole lot of addMenu and addChild function calls" & linebreak

    TOCsuffix= "}" & linebreak & "</script>"

    L1format=linebreak & "var level%%sectioncount%%ID=-1;" & linebreak
    L1format=L1format & "theMenu.addEntry(-1, " 
    L1format=L1format &    q & "folder" & q & ","
    L1format=L1format &    q & "%%linkdesc%%" & q & ","
    L1format=L1format &    q & q & ","
    L1format=L1format &    q & "%%linkdesc%%" & " help" & q & ");"  

    L2format="theMenu.addChild(level%%sectioncount%%" & "ID,"
    L2format=L2format & q & "Document" & q & ","
    L2format=L2format & q & "%%linkdesc%%" & q & ","
    L2format=L2format & q & "%%fullurl%%?view=joust" & q & ","
    L2format=L2format & q & "%%linkdesc%%" & " help" & q & ");" 

    L1eformat=L1eformat & linebreak & "var level%%sectioncount%%ID=-1;" & linebreak
    L1eformat=L1eformat & "theMenu.addEntry(-1, " 
    L1eformat=L1eformat &    q & "document" & q & ","
    L1eformat=L1eformat &    q & "%%linkdesc%%" & q & ","
    L1eformat=L1eformat &    q & "%%fullurl%%?view=joust" & q & ","
    L1eformat=L1eformat &    q & "%%linkdesc%%" & " help" & q & ");" 
CASE "section"
    L1format=""
    L2format="&nbsp;&nbsp;&nbsp;&nbsp;%%linkhref%%<br>"
CASE "sectionpretty"
    pad="&nbsp;&nbsp;&nbsp;&nbsp;"

    L1format="<P><strong><B>%%linkhref%%</strong></b><br>"
    L2format=pad & "%%linkhref%%&nbsp;(%%linkurl%%)<br>"
CASE "sectionplain"
    L1format=""
    L2format="&nbsp;&nbsp;&nbsp;&nbsp;%%linkhref%%<br>"

CASE "listwhichtopic"
    TOCprefix="<form action='/library/where.asp'>"
    TOCprefix=TOCprefix & "<select name='whichtopic'>"
    TOCsuffix="</select>"

    L1format=""
    L2format="<option value='%%fullurl%%'>%%linkdesc%%</option>" & vbcrlf
CASE "listonly"
    L1format=""
    L2format="<option value='%%fullurl%%'>%%linkdesc%%</option>" & vbcrlf
CASE "pretty"
    pad="&nbsp;&nbsp;&nbsp;&nbsp;"
    L1format="<P><strong><B>%%linkhref%%</strong></b><br>"
    L2format=pad & "%%linkhref%%&nbsp;(%%linkurl%%)<br>"
CASE ELSE
    response.write "unknown format"
END SELECT
%>

The Include file lib_toc_v4.asp looks like this:

   filename=/learn/contentlinker/lib_toc_v4.asp

<Test Script Below>


<%
' version 98
' bug:   LimitRandom is sometimes one entry short
' draft: solution to caching issue, each call needs a moniker
' SUB TOCProcess is the Powerhouse here
' Almost every routine calls it
' It can return a string or response.write
' any content linker file and format output
' It can clip number of entries show and/or randomly arrange them


FUNCTION printview()
    printview=False
      printsession=lcase(session("printview"))
      printrequest=lcase(request("printstatus"))
    If printsession="y" OR printrequest="y" then
        printview=True
    end if
END FUNCTION

SUB ShowTOC(parmTOC)
    Call TOCPretty(parmTOC)
END SUB

SUB TOC2ColumnTable(parmTOC)
    Call TOCProcess(parmTOC,"","2coltoc",0,false,false,false)
END SUB

SUB TOC2Joust(parmTOC)
    Call TOCProcess(parmTOC,"","joust",0,false,false,false)
END SUB


SUB TOCGrabSection(parmTOC,parmTarget)
    Call TOCProcess(parmTOC,parmTarget,"section",0,false,false,false)
END SUB

SUB TOCGrabSectionLimit(parmTOC,parmTarget,parmHowMany)
    Call TOCProcess(parmTOC,parmTarget,"section",parmHowMany,false,false,false)
END SUB

SUB TOCGrabSectionPretty(parmTOC,parmTarget)
    Call TOCProcess(parmTOC,parmTarget,"sectionpretty",0,false,false,false)
END SUB

SUB TOCGrabSectionRandom(parmTOC,parmTarget)
    Call TOCProcess(parmTOC,parmTarget,"sectionplain",0,true,false,false)
END SUB

SUB TOCGrabSectionRandomLimit(parmTOC,parmTarget,parmHowmany)
    Call TOCProcess(parmTOC,parmTarget,"sectionplain",parmHowMany,true,false,false)
END SUB

SUB TOCLevel1(parmTOC)
    Call TOCPretty(parmTOC)
END SUB

SUB TOCList(parmTOC,parmForm)
    Call TOCProcess(parmTOC,parmTarget,"listwhichtopic",0,true,false,false)
END SUB

SUB TOClistshort(tocname,jumpname)
    ' Legacy Code, rewrite or ditch
   Set TL = Server.CreateObject ("MSWC.NextLink")
   maxi= cint(TL.GetListCount(tocname))-1
   adinfo="<a href='http://www.activeserverpages.com/contactus.asp'><strong>Contact Us...</strong></a>"
   adinfo=""
   response.write "<FORM ACTION='" & jumpname & "'>"
    response.write "<a href='/search/'>"
    response.write "<img src='/images/search.gif' alt='search' border='0' WIDTH='74' HEIGHT='24'></a>"
    response.write "&nbsp;&nbsp;<a href='/contactus/index.asp'>"
    response.write "<img src='/images/contact.gif' alt='contact' border='0' WIDTH='74' HEIGHT='24'></a>"
     response.write "&nbsp;&nbsp;" & adinfo
   response.write "&nbsp;&nbsp;<SELECT name='whichtopic'><OPTION SELECTED VALUE='/search>Search</option>"
   for i=1 to maxi
      desc=TL.GetNthDescription(tocname,i)
      if mid(desc,1,1)="*" then
         desc=mid(desc,2)
         temp="<OPTION value='" & TL.GetNthURL(tocname,i) & "'>" & desc & "</option>"
         response.write temp
      end if
   next
   set TL=nothing
    response.write "</SELECT>&nbsp;&nbsp;<INPUT VALUE='go!' TYPE='submit'>"
   response.write "<a href='http://www.charlescarroll.com'><img src='/images/cc.gif' border='0' width='150' height='27' alt='Charles Carroll'></a></FORM>"
END SUB

SUB TOCListSection(parmTOC,parmTarget)
    Call TOCProcess(parmTOC,parmTarget,"listwhichtopic",0,false,false,false)
END SUB

SUB TOCPretty(parmTOC)
    allformat=L1format & L2Format    
    Call TOCProcess(parmTOC,"","pretty",0,false,false,false)
END SUB

SUB TOCSection2ListBox(parmTOC,parmTarget)
    Call TOCProcess(parmTOC,parmTarget,"listonly",0,false,false,false)
END SUB

SUB TOCshow(tocname)
    printer="<img src='http://www.activeserverpages.com/learn/printer.gif' WIDTH='33' HEIGHT='29' BORDER='0'>"
    printerlink="<a href='/learn/printswitch.asp'>" & printer & "</a>&nbsp;"

    barcolor="#CCCCFF"

    title=printer
    title=title & "<font face='Arial'><small><strong>Tutorial Questions? write <a href='mailto:aspquicklessons@activeserverpages.com'>aspquicklessons@activeserverpages.com</a> for help!"
    title=title & "</font></small></strong>"
   sn=request.servervariables("script_name")

    tocname=lcase(tocname)
    printstatus=lcase(session("printview"))
    If request("printstatus")="y" then
        printstatus="y"
    end if
   
    if printstatus="y" then
        imgnext="<img src='/learn/arrowright.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
        imgprev="<img src='/learn/arrowleft.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
   else   
        imgnext="<img src='http://www.activeserverpages.com/learn/next.gif' BORDER='0'>" 
        imgprev="<img src='http://www.activeserverpages.com/learn/previous.gif' BORDER='0'>&nbsp;"
   end if
   

    Set NL = Server.CreateObject ("MSWC.NextLink")
    thispage=NL.GetListIndex(tocname)
    lastpage=NL.GetListCount(tocname)
    'response.write "thispage=" & thispage & "<br>"
    If thispage=0 then
           thisrefdesc=""
    ELSE
        thisrefDESC=NL.GetNthDescription(tocname,thispage)
    END IF
         
      If thispage<>lastpage AND thispage<>0 then
            nextref=NL.GetNextURL(tocname)
            nextrefdesc=NL.GetNextDescription(tocname) 
            nextreflink="<a href='" & nextref & "'>" & nextrefdesc & "&nbsp;" & imgnext & "</a>"
            nextlink="<a href='" & nextref & "'>" & imgnext & "</a>"
      Else
            imgnext=""
            nextref=""
            nextrefdesc=""
            nextreflink=""
      end if
      
      If (thispage>1) Then
            prevrefdesc=NL.GetPreviousDescription(tocname)
            prevref=NL.GetPreviousURL(tocname)
            prevreflink="<a href='" & prevref & "'>" & imgprev & prevrefdesc & "</a>"
            prevlink="<a href='" & prevref & "'>" & imgprev & "</a>"
      else
            imgprev=""
            prevref=""
            prevrefdesc=""
            prevreflink=""
      end if

    SELECT CASE printstatus
        CASE "y"
            ' print view!
            host=request.servervariables("http_host")
            host="http://www.learnASP.com"
            response.write "<table border='0' width='100%' bgcolor='#CCCCFF'>"
            response.write "<tr><td align='center'>" & printerlink
            response.write "<font face='Arial'>&nbsp;<strong>"
            response.write host & sn & "&nbsp;&nbsp;by Charles M. Carroll</strong></font><br>"
            response.write prevlink & "&nbsp;&nbsp;"
            response.write "<font face='Arial' size='+1'><strong>Page " & thispage & "</strong></font>"
            response.write nextlink
              response.write "</td></tr></table>"
        CASE ELSE
            response.write "<table border='0' width='100%'>"
            response.write "<tr><td width='50%' bgcolor='#FFCC66'>"
            response.write "<font size='+1'><strong>" & thisrefdesc & "</strong>"
            response.write "</td>"
            response.write "<td width='50%' bgcolor='#FFCC66'>"
            response.write "<strong><small>"
          customTOC=false
            IF instr(tocname,"learn.toc")>0 THEN
                customTOC=TRUE%>
                <!--#include virtual="/learn/toolbar.asp"-->
            <%END IF
            IF instr(tocname,"asplists.toc")>0 THEN
                customTOC=TRUE%>
                <!--#include virtual="/asplists/toolbar.asp"-->
            <%END IF
            if customTOC=false THEN
                      response.write "<a href='toc.asp'>Table of Contents</a>&nbsp;&nbsp;"
                   response.write "<a href='/library/printswitch.asp'>PrintView</a>"
            END IF
            response.write "</small></strong></td></tr>"
            
            response.write "<tr>" & "<td width='50%' bgcolor='" & barcolor & "'>"
          response.write "<strong>" & prevreflink & "</strong></td>"
            
            response.write "<td width='50%' bgcolor='" & barcolor & "' align='right'>"
            response.write "<strong>" & nextreflink & "</strong>"
            response.write "</td></tr></table>"
    END SELECT
   set NL=nothing
end sub

FUNCTION TOCPageType(parmPageURL)
    ' Returns "page" or "toc"
   whichfile=server.mappath(parmpageURL)
   Set fs = CreateObject("Scripting.FileSystemObject")
   If fs.fileexists(whichfile) THEN
        ' do nothing
   ELSE
           response.write "Error, Non-existent File="
           response.write whichfile & "<br>" & vbcrlf
           exit function
   END IF
   Set thisfile = fs.OpenTextFile(whichfile, 1, False)
   tempSTR=lcase(thisfile.readall)
   TOCPageType="page"
   IF instr("tocsubject.asp",tempSTR)>0 THEN
           TOCpageType="toc"
       END IF
   IF instr(tempSTR,"mutanttoc.asp")>0 THEN
           TOCpageType="toc"
       END IF
   IF instr(tempSTR,"mutantsection.asp")>0 THEN
           TOCpageType="toc"
       END IF
   thisfile.Close
   set thisfile=nothing
   set fs=nothing    
END FUNCTION

SUB TOCProcess(parmDIR,parmTargets,parmFormat,parmLimit,parmRandom,byref parmString,parmDebug)
    ' parmDIR can be "/learn" or "/learn/learn.toc"
    ' parmtarget can be "" or a filename i.e. "test.asp"
    ' parmFormat 
    '    L1-<b><strong>-</b></strong><p>-
    '    L2-&nbsp;&nbsp;&nbsp;&nbsp;-<br>-
    ' parmLimit
    '    maximum items (0= all)
    ' parmRandom
    '    True  = Randomize order
    '    False = original order 
    ' parmString
    '    True  = Assign output to passed variable
    '   False  = DisplayOutput normally
    
    DIM count, countmax, FullURL, Issection
    DIM Level, Linker, LinkDesc, LinkURL, LinkHREF
    DIM NameSection, pad
    
    ' First deal with parmDIR
    tocname=lcase(parmdir)
    IF instr(tocname,".toc")=0 THEN
        tocname=parmDIR & parmDIR & ".toc"
        TOCDIR=parmDIR
    ELSE
        tocname=parmDIR
    END IF
    If parmdebug=true THEN
        response.write "TOCname=" & TOCname & "<br>"
    END IF
    
    ' Now extract TOCDIR
    TOCDir=replace(TOCDIR,".toc","")
    findslash=instr(2,TocName,"/")
    tocDIR=mid(TocName,1,findslash-1)
    If parmdebug=true THEN
        response.write "TOCdir=" & tocDIR & "<br>"
    END IF
    
    ' Now extract section target
    Sectiontarget=lcase(parmTargets)
    If parmdebug=true THEN
        response.write "sectiontarget=" & sectiontarget & "<br>"
    END IF
    
    ' Now extract formats
    %>
    <!--#include file="lib_toc_formats.asp"-->
    <%
    IF L1format="" THEN
        skipL1=TRUE
    END IF
    L1emptystring=L1eformat
    L1string=L1format
    L2string=L2format
    IF L1eformat="" THEN
        L1emptystring=L1string
    END IF
    
    If parmdebug=true THEN
        response.write "L1string=" & server.htmlencode(L1string) & "<br>"
        response.write "L2string=" & server.htmlencode(L2string) & "<br>"

        'response.end
   END IF
   
   displayoutput=true
   If parmLimit>0 THEN
        displayoutput=false
    ELSE
        parmLimit=0
   END IF
       If parmString=TRUE OR parmRandom=TRUE THEN
        displayoutput=false
    END IF
    
   ' Now work on the items
   Set Linker = Server.CreateObject ("MSWC.NextLink")
   countmax=cint(Linker.GetListCount(tocname))
   redim preserve thelinks(countmax)
   thelinkscount=0
   
   If displayoutput=TRUE THEN
        response.write TOCprefix
    END IF
   for counter=1 to countmax
        ' SETUP
           LinkDesc=Linker.GetNthDescription(tocname,counter)
           LinkURL =Linker.GetNthURL(tocname,counter)
        FullURL =TocDir & "/" & LinkURL
        
           IF mid(Linkdesc,1,1)="*" THEN
                   linkDesc=mid(linkDesc,2)
                   NameSection=lcase(linkURL)
                   docType="L1"
                   If counter<>countmax THEN
                       LinkDescNext=Linker.GetNthDescription(tocname,counter+1)
                          IF mid(LinkdescNext,1,1)="*" THEN
                              doctype="L1empty"
                    END IF
                   END IF    
                   sectioncount=sectioncount+1
           ELSE
                docType="L2"
        END IF
        IF SectionTarget="" THEN
                ' nothing to do
        ELSE
            IF SectionTarget<>NameSection THEN
                doctype="skip"
            END IF        
        END IF
        
        IF doctype="L1" AND skipL1=TRUE THEN
            doctype="skip"
        END IF
        
        LinkHREF="<a href='" & FullURL & "'>" & linkDesc & "</a>"
        pagecounter=pagecounter+1
        
        ' Fixes " problem inside Desc
        linkdesc=replace(linkdesc,"""","&quot;")
        
        ' Now stuff the variables
        L1output=replace(L1string,"%%linkhref%%",LinkHREF)
        L1output=replace(L1output,"%%linkdesc%%",LinkDesc)
        L1output=replace(L1output,"%%linkurl%%",LinkURL)
        L1output=replace(L1output,"%%fullurl%%",fullURL)
        L1output=replace(L1output,"%%pagecounter%%",pagecounter)
        L1output=replace(L1output,"%%sectioncount%%",sectioncount)

        L1emptyoutput=replace(L1emptystring,"%%linkhref%%",LinkHREF)
        L1emptyoutput=replace(L1emptyoutput,"%%linkdesc%%",LinkDesc)
        L1emptyoutput=replace(L1emptyoutput,"%%linkurl%%",LinkURL)
        L1emptyoutput=replace(L1emptyoutput,"%%fullurl%%",fullURL)
        L1emptyoutput=replace(L1emptyoutput,"%%pagecounter%%",pagecounter)
        L1emptyoutput=replace(L1emptyoutput,"%%sectioncount%%",sectioncount)

        L2output=replace(L2string,"%%linkhref%%",LinkHREF)
        L2output=replace(L2output,"%%linkdesc%%",LinkDesc)
        L2output=replace(L2output,"%%linkurl%%",LinkURL)
        L2output=replace(L2output,"%%fullurl%%",fullURL)
        L2output=replace(L2output,"%%pagecounter%%",pagecounter)
        L2output=replace(L2output,"%%sectioncount%%",sectioncount)
        
        SELECT CASE lcase(doctype)
            CASE "l1"
                If displayoutput=TRUE THEN
                    response.write L1output & vbcrlf
                END IF
                thelinks(thelinkscount)=L1output
                thelinkscount=thelinkscount+1
            CASE "l1empty"
                If displayoutput=TRUE THEN
                    response.write L1emptyoutput & vbcrlf
                END IF
                thelinks(thelinkscount)=L1emptyoutput
                thelinkscount=thelinkscount+1
            CASE "l2"
                IF displayoutput=TRUE THEN
                    response.write L2output & vbcrlf
                END IF
                thelinks(thelinkscount)=L2output
                thelinkscount=thelinkscount+1
            CASE "skip"
                ' nothing to do
        END SELECT        
    NEXT
   If displayoutput=TRUE THEN
        response.write TOCsuffix
    END IF
    set linker=nothing
    
    
    ' Re-arrange the output array if requested
    IF parmRandom=TRUE THEN
        FOR shuffler=1 TO 3
            FOR counter=0 to thelinkscount-1
                randomize    
                randomnum=int(rnd*thelinkscount)
                randchoice=thelinks(randomnum)
                lastchoice=thelinks(thelinkscount)
                thelinks(thelinkscount)=randchoice
                thelinks(randomnum)=lastchoice
            NEXT
        NEXT
    END IF
    
    If parmString=TRUE THEN
        displayoutput=false
    END IF
    
    ' some calls want the string set and no display output
    IF parmstring=TRUE THEN
        IF parmLimit>0 THEN
            parmstring=TOCprefix
            FOR counter=0 TO parmLimit-1
                parmString=parmString & thelinks(counter)
            NEXT
            parmString=ParmString & TOCsuffix
        END IF
        IF parmLimit=0 THEN
            parmString=TOCprefix
            FOR counter=0 to thelinkscount-1
                parmString=parmString & thelinks(counter)
            NEXT
            parmString=ParmString & TOCsuffix
        END IF
        EXIT SUB
    END IF
    
    ' Since they don't want a string lets display what they want
    IF parmLimit>0 AND displayoutput=false THEN
        response.write TOCprefix
        FOR counter=0 TO parmLimit-1
            response.write thelinks(counter) & vbcrlf
        NEXT
        response.write TOCsuffix
    END IF
    ' Show All Output If Needed
    IF parmLimit=0 AND displayoutput=false THEN
        response.write TOCprefix
        FOR counter=0 TO thelinkscount-1
            response.write thelinks(counter) & vbcrlf
        NEXT
        response.write TOCsuffix
    END IF
END SUB
%>

Here is what the ASCII file it uses looks like:

   filename=/learn/learn.toc

<Test Script Below>


index.asp    *ASP Quick Lessons - Table of Contents

credits.asp    *Credits

core.asp    *Core Ideas
whatis.asp    What is ASP? Obtaining The Software
aspinstall.asp    AspInstall listserver
whatisexample.asp    Simple ASP Page, Server Scripting
docs.asp    MS Online Documentation
res.asp    Response: Basics
res2.asp    Response: Buffers, Redirect
res3.asp    Response: Redirection
res4.asp    Response: Quotes & Special Characters
res5.asp    Response: Encoding URLs, HTML
inc.asp    Include: Basics
includedynamic.asp    Include: Dynamic FileName
includeasphttp.asp    Includes: Other Sites, Dynamic FileNames
incwin2k.asp    Include/Redirects: New Win2k Commands
booksample.asp    Include: Books Sample Exercise
booksample2.asp    More Book Sample Exercises
formatnumbers.asp    Format: Numbers #1
formatnumbers2.asp    Format: Numbers #2
formatdates.asp    Format: Dates #1
datetime.asp    Date/Time on ASP Pages by Tony Arguelles
DoLoop.asp    Loops: DO WHILE/UNTIL #1
DoLoop2.asp    Loops: Timeouts #2
DoLoop3.asp    Loops: Intercepting Timeouts #3
server.asp    Server Variables: Popular Ones
server2.asp    Server Variables: Domain/Host Name
serverall.asp    Server Variables: Displaying All
randomadvice.asp    Random Content/Rotating Info
bc.asp    Browscap: Basics
bcdetails.asp    Browscap: Intricate Details
types.asp    Determine Data Types by Charles Carroll
aspbrowserheck.asp    Listserver for Browser Problems

statemanagement.asp    *State Management
stateintro.asp    State Management Introduction
sessionswhat.asp    What are ASP Sessions?
sessionsapps.asp    Application Data
speedappdata.asp    Application Data: Worlds Fastest ListBox
xmlfastlist.asp    XML, Database Caches - Fast Retrieval 
nodbsession.asp    Say No To Databases w/Sessions or Application scope
sessionoverview.asp    Session Overview & Myths
globalproblems.asp    Sessions: Global.asa and Scalability
global.asp    Sessions: Global.asa Events
statemore.asp    Global.asa, Sessions, Custom Stats Resources
stateproscons.asp    State Methods: Pros and Cons
hidden.asp    Pass Data w/Hidden Fields
cookies.asp    Pass Data w/Cookies
statesessions.asp    Pass Data w/Session Vars
statedb.asp    Pass Data w/ID tied to database
aspstatemanagement.asp    [aspStateManagement] Listserver

Form.asp    *Forms/Decisions
formintro.asp    Forms: Introduction
formtextbox.asp    Forms: Text Box
formtextarea.asp    Forms: Text Area
formcheckbox.asp    Forms: Check Box
formradio.asp    Forms: Radio Buttons
formlistbox.asp    Forms: List Box
case.asp    Forms: CASE syntax #1
case2.asp    Forms: CASE syntax #2
if.asp    Forms: IF syntax #1
if2.asp    Forms: IF syntax #2
if3.asp    Forms: IF syntax #3
if4.asp    Forms: IF syntax #4
formforeach.asp    Forms: For Each Iteration
formsubmitself.asp    Form - Submit To Self'
formactionchange.asp    Form - Change Action on Fly


database.asp    *Databases
dbsimple.asp    Displaying Table w/Simple Code
dblist.asp    List Box Displayed Generically
dblistmore.asp    Database to ListBox Online Resources
dbopen.asp    DSNLess Connections
dsn1.asp    DSN Setup #1 by Rob Martinson
dsn2.asp    DSN Setup #2 by Rob Martinson
dsn3.asp    DSN Setup #3 by Rob Martinson
dsn4.asp    DSN Setup #4 by Rob Martinson
dsn5.asp    DSN Setup #5 by Rob Martinson
dsn6.asp    DSN Setup #6 by Rob Martinson
dbfull1.asp    Full Cycle #1 Show/Edit/Update
dbfull2.asp    Full Cycle #2 Show/Edit/Update
dbfull3.asp    Full Cycle #3 Show/Edit/Update
dbtroubleshoot2.asp    SQL Mistakes Everyone Makes
dbtable.asp       DB: Table Displayed Generically
dbtablegetstring.asp    Getstring to display database table
dbtablegetrows.asp    Getrows to display database table
dbtablegetrowsnonum.asp    GetRows w/no Numbers
dbtabledisconnected.asp    Disconnected Recordsets, Display Table
dbtablemore.asp    DB: More ways To Display Tables
genericdb.asp    DB: Generic DB by Eli Robillard
aspgenericdb.asp    Generic DB Listserver
dbconvert.asp    DB: Converting a DB to a Comma-Delimited file
dbSQLdelete.asp    DB: Deleting a Record w/SQL
accesstest.asp    DB: Access Scalability
accesspasswordcount.asp    Access Tips: Passwords, RecordCount
dbtablepaged.asp    ADO: Paging Records
dbmaxrecs.asp    ADO: Limiting Number of Records
dbcount.asp       ADO: Count Records in Query
adocursortypes.asp    ADO: Cursor Types by Phil Paxton
dbnewrec.asp       ADO: Input Form
dbnewSQL.asp       ADO: Input Form, added w/SQL
dbnewADO.asp       ADO: Input Form, Added w/ADO .addnew
dbtablelists.asp    ADO: Tables within Databases
dbschemas.asp    ADO: Schemas to access table lists
dbschemasall.asp    ADO: Schemas to access All Data
db1parm.asp    ADO: Show Table,1 param
dbupdate.asp    ADO: Update/edit Record
dbtroubles.asp    DB: Troubleshooting Part 1
dbtroubles2.asp    DB: Troubleshooting Part 2

SQL.asp    *SQL Basics, Searching Databases
SQLtroubles.asp    SQL Troubles
SQLexamples.asp    SQL: Example Tables
SQLwhere.asp       SQL: Where Clause Basics
SQLwhere2.asp       SQL: Where Clause Examples
SQLwhereform1.asp    SQL: Search Forms #1
SQLwhereform2.asp    SQL: Search Forms #2
SQLwhereform3.asp    SQL: Search Forms #3
SQLandor.asp    SQL: Search AND/OR Operators
SQLandor2.asp    SQL: Search AND/OR Examples
SQLcount.asp    SQL: COUNT, GROUPBY
SQLaggregate.asp    SQL: SUM, MIN, AVE, MAX
dbjoin.asp    SQL Joins by Aaron Alexander

rsfast.asp    *RSFAST: Lightning Fast Database Library
rsfast-intro.asp    RSFast: Library Introduction
rsfast-templates.asp    RSFast: Templates for any look Fast
rsfast-access.asp    RSFast: Templates, MS-Access
rsfast-perf.asp    RSFast: RSFast: Performance Data
rsfast-table.asp    RSFast: Table Display Fast
rsfast-table-cached.asp    RSFast: Table Display Fast + Caching
rsfast-lists.asp    RSFast: Listbox Display Fast
rsfast-lists-cached.asp    RSFast: Listbox Display Fast + Caching
rsfast-lists-debug.asp    RSFast: Debug Info helps troubleshoot
rsfast-lib.asp    RsFast: Library Source Code
rsfast-js.asp    RSFast: Jscript version by Sterling Bates
rsfast-cache.asp    RSFast: caching Method Explained
rsfast-errors.asp    RSFast: Error Messages/Customization
rsfast-cmd.asp    RSFast: Commands
rsfast-newfeatures.asp    RSFast: New Features for Future Versions

editors.asp    *Editors Used With ASP
aspexpress.asp    ASPExpress: HOT ASP Editor
admunsen.asp    Visual Interdev +  Admunsen Resources
aspvisualinterdev.asp    Visual Interdev Listserver
homesite.asp    Homesite: HTML editor
dreamweaver.asp    DreamWeaver: HTML and Script Editor

components.asp    *Essential Commercial Components
aspdb1.asp    ASPDB: Displaying Data
aspdb2.asp    ASPDB: Editing, Adding Data
bhbrowtype.asp    BrowserHawk: Determing Browser Type
bhaol.asp    AOL detection w/BrowserHawk
bhwallet.asp    MS-Wallet w/BrowserHawk
bhresolveip.asp    Reverse DNS lookups w/BrowserHawk
bhframes.asp    BrowserHawk - Frame support
bhflash.asp    Flash Detection w/BrowserHawk
serverobjectsmail.asp    ServerObject Mail: Simple Example
formsendmail.asp    ServerObject: Mailing Form w/ASPMail
aspmail.asp    3rd Party Mail, CDO/CDONTS Listserver
uploadsimple.asp    SA: File Upload, Simple Example
uploadmultipart.asp    SA: File Upload, Multi-part form
uploadlimitsize.asp    SA: File Upload, Limit Size
uploadmanyfiles.asp    SA: File Upload, Many Files
aspsoftartisans.asp    Upload/Soft-Artisans Listserver
perfcounters.asp    Perf Counters on ASP page

authenticate.asp    *Authentication & Security
authenticateoverview.asp    Authenticate: Overview by Kevin Flick
authenticatecomparisons.asp    Authenticate: Comparison by Kevin Flick
authenticatentcr.asp    Authenticate: NT Challenge/Response by Kevin Flick
authenticatebasic.asp    Authenticate: Basic Authentication by Kevin Flick
authenticatecookies.asp    Authenticate: Cookies by Kevin Flick
authenticatecertificate.asp    Authenticate: Certificates by Kevin Flick
authenticatebuild.asp    Authenticate: Build Your Own by Kevin Flick
security.asp    Authenticate: Protect Pages via Login #1
security2.asp    Authenticate: Protect Pages via Login #2
authenticate3rdparty.asp    Authenticate: 3rd Party by Kevin Flick
aspflicks.asp    Authentix Flicks Support Listserver

troubles.asp    *Troubleshooting, Error Trapping
errors1.asp    Errors: Basics
errors2.asp    Errors: More Ways To Trap
errormore.asp    Errors: Resources Online
dbtablewitherrortrap.asp    Errors: Trapping EVERY Error
debug1.asp    Debug variables Easy Way
dbtroubleshoot.asp    Errors: DB Error Information Trapping
FAQdbUpdate.asp    DBFAQ: Operation must use Updatable Query
FAQdbSinglequote.asp    DBFAQ: User Entered ' in field
FAQdbLIKE.asp    DBFAQ: LIKE operator * not working
FAQdbMEMO.asp    DBFAQ: retrieving MEMO/BLOBs generates error
FAQdbSQLSyntax.asp    DBFAQ: Syntax Error in SQL Statement
debug2.asp    SQL Debugging Made Easy
dbtroubleshootopen.asp    Errors: Trapping Open Connections
asptroubles.asp    Troubleshoot: Getting Help from Lists!
asptroubles2.asp    Troubleshoot: Worldwide
asptroubles3.asp    Troubleshoot: Specialized
versioncheck.asp    Troubleshoot: Version of ASP Sofware
componentchecker.asp    Troubleshoot: Registered Components
connectioninfo.asp    Troubleshoot: DB Drivers by Christophe Wille
PWS.asp    PWS: Personal Web Server Introduction

qualitycode.asp    *Code w/all ASP Features. Quality, Re-usable Code
strings.asp    Strings: Core Functions
stringsplit.asp    Strings: SPLIT Function
stringreplace.asp    Strings: REPLACE Function
stringjoin.asp    Strings: JOIN Function
arrays.asp    Arrays: Basics
arrays2.asp    Arrays: Variable Size 
arrays3.asp    Arrays: Best Way To Load
arraysmore.asp    Arrays: Resources Online
dictionary.asp    Dictionary Objects
subdates.asp    Subroutine: Working with Dates #1
subdates2.asp    Subroutine: Working with Dates #2
subdbtable.asp    Subroutine: Query2Table
subdblist.asp    Subroutine: Query2List
subreusable.asp    Subroutine: Highly Reusable
subdictionary.asp    Subroutines w/Dictionary Objects
getrowsultimate.asp    Getrows Ultimate!
subDBlistbest.asp    Subroutine: List Box w/optional params
libhtml.asp    Subroutine: Abstract HTML by Phil Paxton
functionworkingdays.asp    Function: Working Days
vbs5.asp    New Features in VBScript version5
txtread.asp    Text Files: Reading Them off Server
txtwrite.asp    Text Files: Writing Them on Server
mb1.asp    Text Files: Meyers-Briggs parsing #1
mb2.asp    Text Files: Meyers-Briggs parsing #2
mb3.asp    Text Files: Meyers-Briggs parsing #3
xmlmb.asp    XML/XLST Myers-Briggs example
cl.asp    Content Linker: Prev/Next Page
cl2.asp    Content Linker: Table of Contents
cl3.asp    Content Linker: Listbox of contents
contentlinker.asp    Content Linker Library
fileobjects.asp    File Objects: Read Directory
fileobjects2.asp    File Objects: Display Directory as Links/Graphics
fileobjects3.asp    File Objects: Read Disk Drive by Steven Harper
graphicdetect.asp    Graphic Size Detector

speedscale.asp    *High Speed Code, Scalable Code...
speedtimer.asp    Time Tasks with Millisecond Accuracy
speedtips.asp    Speed: Coding Tips
whybuffer.asp    Why Buffer?
whygetrows.asp    Why GetRows or Getstring to get Data
speedserver.asp    Speed: Server Optimization
speedmore.asp    Speed/Optimize Resources
speedresearch.asp    Speed: [aspfastcode] listserver
speedtables.asp    Speed: Database Percieved Speed
speedtablesall.asp    Database Retrieval Speed
speedtablesdrivers.asp    OLEDB & ODBC Drivers differences
isclientconnected.asp    IsClientConnected & Stray Tasks
nothing.asp    Scale: Virtues of Nothing
dbpooling.asp    Scale: Connection Pooling
threads.asp    Thread Basics: What is a Thread?
threadsafe.asp    Thread Safety Issues
roundrobin.asp    Round-Robin Code Execution
aspscalability.asp    ASP Scalability Listserver

buildcomponents.asp    *ASP Components Building
buildc.asp    C++/ATL: Component Building
buildjava.asp    Java ASP Components Building
buildvbsimple.asp    VB: Simple Component
buildregister.asp    VB: Registering Component
FAQvbDLLoverwrite.asp    VB: DLL overwrite problems
buildvbado.asp    VB: ADO, Run It!
buildvbado2.asp    VB: ADO, Build It!
buildvbguidelines.asp    VB: Warnings/Guidelines
buildvb.asp    VB: General Building Guidelines
buildvb2.asp    VB: Installation Requirements
buildvbthreads.asp    VB: Threading Models

buildmtx.asp    *MTS - Microsoft Transaction Server
buildmtxoverview.asp    MTS: Overview
buildmtx2.asp    MTS: Essentials
buildmtxasp.asp    MTS: Transactional ASP pages
booksmtx.asp    MTS: Book
booksmtx2.asp    MTS: Book
buildmtxregister.asp    MTS: Registering Components

advice.asp    *Advice For Better Coding!
dbsessionapp.asp    Database in Session or App. Say NO!
cachenomore.asp    advice: Cache No More by Phil Paxton
explicit.asp    advice:Option Explicit
encode.asp    advice: Encode with Redirects
sqlwrite.asp    advice: Write Your SQL
namedconstants.asp    advice: Named constants for ADO are better
cleanup.asp    advice: Clean Up Your Room, I mean Objects
pathmap.asp    advice: Server.MapPath is Good
nosessionobjects.asp    advice: Just Say No to Session COM objects
propertyexpense.asp    advice: Don't Read COM Properties Twice
securecode.asp    advice: Secure Code and Data
encapsulate.asp    advice: Encaspulate Code!
caseisbetter.asp    advice: CASE reads better than IF
errorstrategies.asp    advice: Error Trapping Strategies
errorsecrets.asp    advice: Error Trapping Secrets
shoulds.asp    advice: You Should...


overview.asp    *Appendix A: Overview of ASP Objects
aspobjects.asp    ASP Objects: Built In
aspobjects2.asp    ASP Objects: Created when Needed

webcom.asp    *Appendix B: Related Web/Com Technologies
indexserver.asp    Index Server via ADO
commerce.asp    Commerce and ASP
javascript.asp    Server JavaScript: Resources
validationmore.asp    Validation Resources
listdynamic.asp    Listboxes: Linked Dynamically w/JavaScript
listdynamicmore.asp    Dynamic ListBox Online Examples
listdynamicdb.asp    Listboxes: Linked Dynamically from Database w/JavaScript
listdual.asp    Listboxes: Easy Choices by Bill Wilkinson
perlscript.asp    Server Perlscript: Resources
remotescripting.asp    Remote Scripting Simple Example
remotescriptinglist.asp    Remote Scripting Listbox
remotescriptingms.asp    Remote Scripting Microsoft Example
aspremotescripting.asp    [aspRemoteScript] list
rds.asp    RDS: Remote Data Services Intro
prothman.asp    RDS Resources by Carl Prothman
ADSI.asp    ADSI: Active Directory Services Interface Intro
MSMQ.asp    MSMQ: Overview
usability.asp    Usability: Resources
safecolors.asp    Usability: Safe Color Pallete

oracle.asp    *Appendix C: Oracle and ASP
FAQOracleconnect.asp    Oracle: I can't connect
asporacle.asp    Oracle: Getting Help from Listserver
FAQOraclestoredproc.asp    Oracle: Calling Stored Procs
oracleoledbpooling.asp    Oracle: OLEDB Resource(Session) Pooling
oraclerecordsetsfromsp.asp    Oracle: Recordsets from Stored Procedures using REF CURSORs
oraclerecordsetsado.asp    Oracle: Returning Recordsets via ADO
FAQOraclebooks.asp    Oracle: Know any good books?

research.asp    *Appendix D: ASP Books & Online Resources
bookcomponents.asp    Must Buy Component Building Book
asp101.asp    ASP101.com Scripts for your site
4guysfromrolla.asp    4GuysFromRolla.com Tons of ASP Material
asptoday.asp    ASPToday.com from WROX

faqs.asp    *Appendix E: Frequently Asked Questions
FAQCommerceCertif.asp    Commerce: certificates, https://
FAQCommerceCharge.asp    Commerce: online charging
FAQCommerceCarts.asp    Commerce: components, shopping carts
FAQJscriptCleanUp.asp    Jscript: closing DB Connections
FAQJscriptRefs.asp    Jscript: online references
FAQJscriptDB.asp    Jscript: display databases
FAQvbBooks.asp    VB: Recommended books

subjectindex.asp    *Subject Index
subjectado.asp    Active Data Objects (ADO)
subjectarrays.asp    Arrays
subjectauthenticate.asp    Authentication
subjectbrowsers.asp    Browser Detection
subjectdropdowns.asp    Dropdown List Boxes


alphaindex.asp    *Alphabetical Index



There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.