CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>

The Organization Library Table of Contents PrintView CL1
<Previous> Tutorials - Showing Code

Organizing with TOCs, Next/Prev <Next>


       

/learn/learnlib.asp -- the nucleus of our site organization strategy

Our site is arranged like a book with 3/4 page chunks, next and previous buttons, and a TOC for each major section. This is done consistently throughout the site thanks to one library.

Here is the /learn/learnlib.asp code:

<Test Script Below>

<%
sub ShowASPcom(whichasp)
      call showASPInternal("C:\inetpub\wds96159" & whichasp,"N")
end sub

sub showASPButton(whichASP)
      quote=chr(34)
      dim ref, findquestion
      findquestion=instr(whichASP,"?")
      IF findquestion>0 THEN
       whichASPfile=mid(whichASP,1,findquestion-1)
      ELSE
       whichASPfile=whichASP
      END IF

      Set fs = CreateObject("Scripting.FileSystemObject")
      Set thisfile = fs.GetFile(server.mappath(whichASPfile))
      filedate=thisfile.DatelastModified
      label=whichASP
      twodaysago=dateadd("d",-2,now())

      'response.write "Filedate=" & filedate & "<br>"
      'response.write "twodaysago=" & twodaysago & "<br>"

      IF filedate>twodaysago THEN
       ' nothing to do
      ELSE
       whichASP="http://backup.activeserverpages.com" & whichASP
      END IF
      set fs=nothing
      set thisfile=nothing

      If findquestion=0 then
       ref="<Form action=" & quote & whichASP & quote
       ref=ref & " target=" & quote & "_blank" & quote & ">"
       ref=ref & "<input type='submit' value='"
       ref=ref & "Test the Script --> " & label & "'></form>"
       response.write ref & "<p>"
      else
       ref="<A href=" & quote & whichASP & quote
       ref=ref & " target=" & quote & "_blank" & quote & ">"
       ref=ref & "Test This -->" & whichASP & "</a><p>"
       response.write ref
      end if
end sub

sub showASPcode(whichASPfile)
      call showASPInternal(whichaspfile,"Y")
end sub

sub showASPInternal(my_whichASP,my_pathmap)
      Call showASPInternalPaul(my_whichASP,my_pathmap)
end sub


sub showASPInternalPaul(whichasp,pathmap)%>

      <!--#include file="learnlibshowcodepaul.asp"-->
<%end sub

sub showASPInternalcmc(whichasp,pathmap)
      Dim fs 'Temp Filesystem Object
      Dim a 'Temp Textfile Object
      Dim counter 'Line number counter
      Dim pad 'Character for padding with spaces
      Dim thisline 'Holds current line
      Dim thislineup 'Uppercase line
      Dim leftside 'Prefixes to line
      Dim rightside 'Suffixes to line
      Dim scriptstart 'ASP script start characters
      Dim scriptend 'ASP script end characters
      dim scriptcolor
      dim htmlcolor
      dim whichfile
      dim tabreplacer
      dim quote,gt,lt
      dim querystring
      dim findquestion,printstatus

      quote=chr(34)
      gt=server.htmlencode(">")
      lt=server.htmlencode("<")
      findper=instr(whichASP,".")
      ext=lcase(mid(whichASP,findper+1,3))
      scriptstart="<" & "%"
      scriptend="%" & ">"
      quote=chr(34)

      tabreplacer="&nbsp;&nbsp;&nbsp;"

      findquestion=instr(whichASP,"?")
      If findquestion > 0 then
       querystring=mid(whichasp,findquestion)
       whichASP=mid(whichASP,1,findquestion-1)
       'response.write querystring & "<p>"
      end if

      If pathmap="Y" then
       whichfile=server.mappath(whichASP)
      else
       whichfile=whichASP
      end if

      Set fs = CreateObject("Scripting.FileSystemObject")
      Set a = fs.OpenTextFile(whichfile, 1, False)

      response.write "printstatus=" & request("printstatus") & "<br>"
      If request("printstatus")="y" then
       printstatus="y"
      else
       printstatus=lcase(session("printview"))
      end if


      if printstatus<>"y" and ext="asp" and instr(whichASP,"respond.asp")=0 then
       'response.write whichASP & querystring
       Call showASPbutton(whichASP & querystring)
      end if
      
      counter=0

      htmlcolor="<font face='Courier New' size='2' color='#004040'>"
      scriptcolor="<font face='Courier New' size='2' color='#008000'>"
      scriptcolorend="</font>" & htmlcolor
      'includecolor="<font face='Courier New' size='2' color='#0080FF'>"
      'includecolorend="</font>" & htmlcolor

response.write (htmlcolor)
do   while not a.AtEndOfStream
      printline=true
      counter=counter+1
      if counter<10 then
       pad="&nbsp;"
      else
       pad=""
      end if
      thisline=a.readline
      thislineup=ucase(thisline)
      leftside=""
      rightside=""

      if instr(thislineup,"<TITLE>")>0 then
       leftside="<strong><font color=""#0080FF"">"
       rightside="</font></strong>"
      end if



      
      subpos=instr(thislineup,"SUB")
      if subpos>0 and subpos<7 then
       'leftside="<strong><font color=""#0080FF"">"
       'rightside="</font></strong>"
       leftside="<strong>"
       rightside="</strong>"
      end if

      if instr(thislineup,"END SUB")>0 then
       'leftside="<strong><font color=""#0080FF"">"
       'rightside="</font></strong>"
       leftside="<strong>"
       rightside="</strong>"
      end if

      if ext="cls" then
       ' COLOR CODE
       if instr(thislineup,"PUBLIC PROPERTY")>0 then
       leftside="<strong><font color=""#0080FF"">"
       rightside="</font></strong>"
       end if

       if instr(thislineup,"END PROPERTY")>0 then
       leftside="<strong><font color=""#0080FF"">"
       rightside="</font></strong>"
       end if

       if instr(thislineup,"PUBLIC SUB")>0 then
       'leftside="<strong><font color=""#0080FF"">"
       'rightside="</font></strong>"
       leftside="<strong>"
       rightside="</strong>"
       end if
      

       ' ELIMINATE JUNK
       if instr(thislineup,"VERSION 1.0 CLASS")>0 then
       printline=false
       end if
       if instr(thislineup,"BEGIN")>0 then
       printline=false
       end if
       if instr(thislineup,"MULTIUSE =")>0 then
       printline=false
       end if
       if trim(thislineup)="END" then
       printline=false
       end if
       if instr(thislineup,"ATTRIBUTE VB_")>0 then
       printline=false
       end if
      
       if instr(thislineup,"PERSISTABLE")>0 then
       printline=false
       end if
      
       if instr(thislineup,"DATABINDINGBEHAVIOR")>0 then
       printline=false
       end if
      
       if instr(thislineup,"DATASOURCEBEHAVIOR")>0 then
       printline=false
       end if
       if instr(thislineup,"MTSTRANSACTIONMODE")>0 then
       printline=false
       end if
      end if


      if instr(thislineup,scriptstart)=1 then
       leftside=scriptcolor
       rightside=""
      end if
      thisline=server.htmlencode(thisline)
      thisline=replace(thisline,"'","<font color=""#FF0000""></strong>'</strong></font>")
      thisline=replace(thisline,"&quot;","<font color='#800000'></strong>&quot;</strong></font>")
      thisline=replace(thisline,"&lt;%=", scriptcolor & "&lt;%=" )
      thisline=replace(thisline,"&lt;% =", scriptcolor & "&lt;%=" )
      thisline=replace(thisline,"&lt;%", scriptcolor & "&lt;%" )
      thisline=replace(thisline,"%&gt;","%&gt;" & scriptcolorend)
      'thisline=replace(thisline,"&lt;!--",includecolor & "&lt;!--")
      'thisline=replace(thisline,"--&gt;","--&gt;" & includecolorend)
      thisline=replace(thisline,chr(9),tabreplacer)

      firstbit=mid(thisline,1,3)
      firstbit=replace(firstbit," ","&nbsp;&nbsp;")
      thisline=firstbit & mid(thisline,4)

      if printstatus="y" and printline=true then
       response.write "<font color=""#FF0000"">" & counter & pad & "</font>&nbsp;&nbsp;&nbsp;"
      end if
       if printline=true then
       response.write leftside & thisline & rightside & "<br>" & vbcrlf
       end if
      printline=true
loop
response.write ("</font>")
a.Close
set a=nothing
set fs=nothing
end sub

sub ShowASP
      call showASPInternal(whichasp,"Y")
end sub

SUB showTOC(my_tocname)
      Call tocshow(my_tocname)
End Sub%>



<%
SUB TOCLevel1(tocname)
      Dim TL 'NextLink object
      Dim maxi 'Count variable
      Dim thispagedesc 'Description of URL
      Dim showitems 'Flag
      Set TL = Server.CreateObject ("MSWC.NextLink")
      maxi= cint(TL.GetListCount(tocname))
      thispagedesc=TL.GetNthDescription(tocname,TL.GetListIndex(tocname))
      showitem="N"
      for i=1 to maxi
       desc=TL.GetNthDescription(tocname,i)
       if mid(desc,1,1)="*" then
       showitem="Y"
       desc=mid(desc,2)
       end if
       if i=1 then
       showitem="N"
       end if
       If showitem="Y" Then%>

       &nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=TL.GetNthURL(tocname,i)%>"><%=desc%>&nbsp;&nbsp(Page <%=i%>)</a><br>
       <%end if
       showitem="N"
      next
      set TL=nothing
end sub%>


<%
SUB TOCLevel2(tocname)
      Dim TL 'NextLink object
      Dim maxi 'Count variable
      Dim thispagedesc 'Description of URL
      Dim showitems 'Flag
      Set TL = Server.CreateObject ("MSWC.NextLink")
      maxi= cint(TL.GetListCount(tocname))
      thispagedesc=TL.GetNthDescription(tocname,TL.GetListIndex(tocname))
      showitems="N"
      %>

      <strong><big><font face="Arial">
      <%
      response.write thispagedesc & " - Section Contents<p>"
      response.write "</font></big></strong>"
      for i=1 to maxi
       desc=TL.GetNthDescription(tocname,i)
       if mid(desc,1,1)="*" then
       showitem="N"
       end if
       If showitem="Y" Then%>

       &nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=TL.GetNthURL(tocname,i)%>"><%=desc%>&nbsp;&nbsp(Page <%=i%>)</a><br>
       <%end if
       if desc=thispagedesc then
       showitem="Y"
       end if%>

      <%next
       set TL=nothing
end sub%>


<%
SUB TOCList(tocname,jumphandler)
      Dim TL 'NextLink object
      Dim maxi 'Count variable
      Dim i 'Loop control
      Dim desc 'Description of link
      %>

      <FORM ACTION="<%=jumphandler%>">
      <%
      Set TL = Server.CreateObject ("MSWC.NextLink")
      maxi= cint(TL.GetListCount(tocname))
      %>

      <INPUT VALUE="Go:" TYPE=submit>&nbsp;&nbsp;
      <SELECT name="whichtopic">
      <OPTION SELECTED VALUE="toc.asp">Table of Contents
      <%for i=1 to maxi%>
      <OPTION value=
      <%=TL.GetNthURL(tocname,i)%>
      >
      <%
      desc=TL.GetNthDescription(tocname,i)
      if mid(desc,1,1)="*" then
       desc=mid(desc,2)
      else
       desc="&nbsp;&nbsp;&nbsp;&nbsp;" & desc
      end if
      %>

      <%=desc%>
      <%next
      set TL=nothing
      %>

      </SELECT></FORM>
<%end sub%>


<%sub TOClistshort(tocname,jumpname)
      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=""
      %>

      <FORM ACTION="<%=jumpname%>">
      <a href="/search/">
      <img src="/images/search.gif" alt="search" border="0" WIDTH="74" HEIGHT="24"></a>
      &nbsp;&nbsp;
      <a href="/contactus/index.asp">
      <img src="/images/contact.gif" alt="contact" border="0" WIDTH="74" HEIGHT="24"></a>
      &nbsp;&nbsp;
      <%=adinfo%>&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
      %>

      </SELECT>&nbsp;&nbsp;<INPUT VALUE="go!" TYPE=submit>
      <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 TOCPretty(tocname)
      Dim TL 'NextLink object
      Dim maxi 'Count variable
      Dim i 'Loop control
      Dim desc 'Description of URL
      dim startHTML, endHTML
      Set TL = Server.CreateObject ("MSWC.NextLink")
      maxi= cint(TL.GetListCount(tocname))
      counter=0
      DO UNTIL counter=maxi
       counter=counter+1
       'response.write counter & " "
       desc=TL.GetNthDescription(tocname,counter)
       descURL=TL.GetNthURL(tocname,counter)
       printme=true
       firstchar=mid(desc,1,1)
       'response.write firstchar
       if firstchar="*" then
       startHTML="<B>"
       endHTML="</b><br>"
       desc=mid(desc,2)
       else
       startHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
       endHTML="<br>"
       end if
       response.write startHTML
       response.write "<a href='" & descURL & "'>"
       response.write desc & " (Page " & counter & ")</a>"
       response.write endHTML & vbcrlf
      LOOP
      
      set TL=nothing
       %>

<%end sub%>


<%
SUB TOCshow(tocname)
    tocname=lcase(tocname)
       printstatus=lcase(session("printview"))
       If request("printstatus")="y" then
       printstatus="y"
       end if
       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;"
      
       'imgnext="<img src='../learn/arrowright.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
       'imgprev="<img src='../learn/arrowleft.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
      
       'imgnext="<img src='../images/handnext.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
       'imgprev="<img src='../images/handback.gif' WIDTH='33' HEIGHT='14' BORDER='0'>"
      


      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
      
       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>"
      
      
       barcolor="#CCCCFF"
      
       sn=request.servervariables("script_name")

      
       Set NL = Server.CreateObject ("MSWC.NextLink")
       thispage=NL.GetListIndex(tocname)
       lastpage=NL.GetListCount(tocname)
       thisrefDESC=NL.GetNthDescription(tocname,NL.GetListIndex(tocname))
      
       If thispage<>lastpage 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"
       %>

       <table border="0" width="100%" bgcolor="#CCCCFF"><tr>
      
       <td align="center">
       <%=printerlink%><font face="Arial">&nbsp;<strong><%=host%><%=sn%>&nbsp;&nbsp;by Charles M. Carroll</strong></font>
       <br>
       <%=prevlink%>&nbsp;&nbsp;<font face="Arial" size="+1"><strong>Page <%=thispage%></strong></font>&nbsp;&nbsp;<%=nextlink%>
       </td>
       </tr></table>
       <%CASE ELSE%>
      
       <table border="0" width="100%">

       <tr>
       <td width="50%" bgcolor="#FFCC66">
       <font size="+1"><strong><%=thisrefdesc%></strong>
       </td>

       <td width="50%" bgcolor="<%=barcolor%>">
       <strong><small>

       <%IF instr(tocname,"learn.toc")>0 THEN%>
              <a href='toc.asp'>TOC</a>&nbsp;&nbsp;
              <a href='/learn/joust' target='_blank'><strong>TreeView</a>&nbsp;&nbsp;
              <a href='/learn/printout.asp'><strong>Print All</a>&nbsp;&nbsp;
    <a href='/learn/download.asp'><strong>Download</a>&nbsp;&nbsp;
             <a href='/learn/printswitch.asp'>PrintView</a>&nbsp;&nbsp;
         <%ELSE%>
              <a href='toc.asp'>Table of Contents</a>&nbsp;&nbsp;
             <a href='/learn/printswitch.asp'>PrintView</a>
         <%END IF%>
       </small></strong>
       </td>
       </tr>

       <tr>
       <td width="50%" bgcolor="<%=barcolor%>">
       <strong><%=prevreflink%></strong>
       </td>

       <td width="50%" bgcolor="<%=barcolor%>" align="right">
       <strong><%=nextreflink%></strong>
       </td>

       </tr>
      
       </table>
       <%
       set NL=nothing
      END SELECT
end sub%>

It includes a file called
learnlibshowcodepaul.asp
which displays the source code to the /learn directory. This was prepared by Paul Rigor in Texas. I have never met him but he rewrote my code substantially and we swapped a lot of emails getting this piece ready.

<Test Script Below>

<%
Dim fs 'Temp Filesystem Object
Dim a 'Temp Textfile Object
Dim counter 'Line number counter
Dim pad 'Character for padding with spaces
Dim thisline 'Holds current line
Dim thislineup 'Uppercase line
Dim leftside 'Prefixes to line
Dim rightside 'Suffixes to line
Dim scriptstart 'ASP script start characters
Dim scriptend 'ASP script end characters
dim scriptcolor
dim htmlcolor
dim whichfile
dim tabreplacer
dim quote,gt,lt
dim querystring
dim findquestion,printstatus

quote=chr(34)
gt=server.htmlencode(">")
lt=server.htmlencode("<")
ugt = ucase(gt)
ult = ucase(lt)

CommentStart = Server.htmlencode("<" & "!--")
CommentIncludeEnd = Server.htmlencode("--" & ">")
IncludeStart = Server.htmlencode("<" & "!--#")
scriptcomment = Server.htmlencode("'")
singleQuote = Server.htmlencode("'")

findper=instr(whichASP,".")
ext=lcase(mid(whichASP,findper+1,3))
scriptstart=server.htmlencode("<" & "%")
scriptend=server.htmlencode("%" & ">")
quote=chr(34)

tabreplacer="&nbsp;&nbsp;&nbsp;"

findquestion=instr(whichASP,"?")

If  findquestion > 0 then
   querystring=mid(whichasp,findquestion)
   whichASP=mid(whichASP,1,findquestion-1)
   'response.write querystring & "<p>"
end if

If  pathmap="Y" then
   whichfile=server.mappath(whichASP)
else
   whichfile=whichASP
end if

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(whichfile, 1, False)
If  error.number<>0 THEN
   response.write "not found:" & whichfile & "<br>"
   exit sub
END IF
dim respondtemp, libtemp
respondtemp=instr(whichASP,"respond.asp")
libtemp=instr(whichASP,"lib_")

   If request("printstatus")="y" then
      printstatus="y"
   else
      printstatus=lcase(session("printview"))
   end if

if  printstatus<>"y" and ext="asp" and libtemp=0 and respondtemp=0 then
   'response.write whichASP & querystring
   Call showASPbutton(whichASP & querystring)
end if

counter=0
%>

<!--#include file="learnlibcolorprefs.asp"-->
<%
response.write (htmlcolor)

do  while not a.AtEndOfStream
   printline=true
   counter=counter+1
   if counter<10 then
      pad="&nbsp;"
   else
      pad=""
   end if



   foundspace=instr(thisline,"< ")
   do while foundspace>0
          thisline=replace(thisline,"< ", "<")
    foundspace=instr(thisline,"< ", "<")
   loop

   foundspace=instr(thisline, " >")
   do while foundspace>0
          thisline=replace(thisline," >", ">")
    foundspace=instr(thisline," >")
   loop

   thisline=Server.HtmlEncode(a.readline)

   'Emphasize the <TITLE>
   thislineup=ucase(thisline)
   if instr(thislineup, ult & "TITLE" & ugt)>0 then
      int_TitleEndTagPos = instr(thislineup, ult & "/TITLE" & ugt)
      If int_TitleEndTagPos = 0 Then
         int_TitleEndTagPos = Len(thisline)
      else
         int_TitleEndTagPos = int_TitleEndTagPos+ Len(ult & "/TITLE" & ugt)
      End If
      
      thisline=left(thisline, instr(thislineup, ult & "TITLE" & ugt) - 1) & titlecolor & (Mid(thisline,instr(thislineup, ult & "TITLE" & ugt), int_TitleEndTagPos)) & TitleColorEnd
   end if

   thislineup=ucase(thisline)
   if instr(thislineup, ult & "/TITLE" & ugt)>0 and instr(thisline, titlecolor) = 0 then
      int_TitleEndTagPos = instr(thislineup, ult & "/TITLE" & ugt)
      thisline = titlecolor & left(thisline, int_TitleEndTagPos + Len(ult & "/TITLE" & ugt)) & titlecolorend
      
   end if   

   If instr(thisline, CommentStart) > 0 Then
      'thisline = left(thisline, instr(thisline, CommentStart) - 1) & CommentColor & right(thisline, Len(thisline) - (instr(thisline, CommentStart) -1))
      thisline = replace(thisline, CommentStart, CommentColor & CommentStart)
      IsComment=1
   End If

   If instr(thisline, IncludeStart) > 0 and IsComment=0 Then
      'thisline = left(thisline, instr(thisline, IncludeStart) - 1) & CommentColor & right(thisline, Len(thisline) - (instr(thisline, IncludeStart) - 1))
      thisline = replace(thisline, IncludeStart, CommentColor & IncludeStart)
      IsComment=1
   End If
   If instr(thisline, CommentIncludeEnd) > 0 and IsComment = 1Then
      'thisline = left(thisline, instr(thisline, CommentIncludeEnd) + Len(CommentIncludeEnd)) & CommentIncludeColorEnd & right(thisline, (Len(thisline) - ((instr(thisline, CommentIncludeEnd) + (Len(CommentIncludeEnd) - 1)))))
      thisline = replace(thisline, CommentIncludeEnd, CommentIncludeEnd & CommentIncludeColorEnd)
      IsComment=0
   End If
   
   'Do the single quotes
   thisline = replace(thisline, SingleQuote, SingleQuoteColor & SingleQuote & SingleQuoteColorEnd)

   subpos=instr(ucase(thisline),"END SUB")
   
   if subpos > 0 and subpos < 7 then
      strTemp = Mid(thisline, subpos, len("END SUB"))
      strTemp2 = subcolor & strTemp & subcolorend
      thisline=replace(thisline, strTemp, StrTemp2)
   end if

   subpos=instr(ucase(thisline),"END FUNCTION")
   
   if subpos>0 and subpos<7 then
      strTemp = Mid(thisline, subpos, len("END FUNCTION"))
      strTemp2 = subcolor & strTemp & subcolorend
      thisline=replace(thisline, strTemp, StrTemp2)
   end if


   subpos=instr(ucase(thisline),"SUB ")
   
   if subpos>0 and subpos<7 then
      thisline = subcolor & thisline & SubColorend
   end if

   subpos=0
   subpos=instr(ucase(thisline),"FUNCTION ")
   
   if subpos>0 and subpos<7 then
      thisline = subcolor & thisline & SubColorend
   end if

   If instr(thisline, ScriptStart) > 0 Then
      strTmp = ScriptColor & ScriptStart
      thisline = replace(thisline, ScriptStart, StrTmp)
      inscript = 1
   End If

   If instr(thisline, ScriptEnd) > 0 Then
      strTmp = ScriptEnd & ScriptColorEnd
      thisline = replace(thisline, ScriptEnd, ScriptEnd & ScriptColorEnd)
      inscript = 0
   End If

   
   If inscript = 1 and colorcomment = true Then
   subpos = instr(thisline, ScriptComment)
   If subpos > 0 Then
      
      If left(trim(thisline),Len(ScriptComment)) = ScriptComment Then
         thisline = ScriptCommentColor & thisline & ScriptCommentColorEnd
      Else
         QuoteEnd = 0
         For Comment = 1 to Len(thisline)
            If Mid(thisline, comment, Len(ScriptComment)) = Chr(34) and NoComment=0 Then
               NoComment=1
            End If
            If Mid(thisline, comment, Len(ScriptComment)) = Chr(34) and NoComment=1 Then
               NoComment=0
            End If
            
            If Mid(thisline, comment, Len(ScriptComment)) = "(" Then
               NoComment = 1
            End if
            If Mid(thisline, comment, Len(ScriptComment)) = ")" Then
               NoComment = 0
            End if

            If Mid(thisline, comment, Len(ScriptComment)) = "'" and NoComment = 0 Then
               thisline = replace(thisline, "'", ScriptCommentColor & "'", Comment, 1) & ScriptCommentColorEnd
               Exit For
            End if
                     
            
         Next
      End If
   End If
   End If
   


   if ext="cls" then
      thislineup = ucase(thisline)
      ' COLOR CODE
      if instr(thislineup,"PUBLIC PROPERTY")>0 then
         thisline = subcolor & thisline & SubColorend
      end if

      if instr(thislineup,"END PROPERTY")>0 then
         thisline = subcolor & thisline & SubColorend
      end if

      if instr(thislineup,"PUBLIC SUB")>0 then
         thisline = subcolor & thisline & SubColorend
      end if

      ' ELIMINATE JUNK
      if instr(thislineup,"VERSION 1.0 CLASS")>0 then
         printline=false
      end if
      if instr(thislineup,"BEGIN")>0 then
         printline=false
      end if
      if instr(thislineup,"MULTIUSE =")>0 then
         printline=false
      end if
      if trim(thislineup)="END" then
         printline=false
      end if
      if instr(thislineup,"ATTRIBUTE VB_")>0 then
         printline=false
      end if

      if instr(thislineup,"PERSISTABLE")>0 then
         printline=false   
      end if

      if instr(thislineup,"DATABINDINGBEHAVIOR")>0 then
         printline=false
      end if

      if instr(thislineup,"DATASOURCEBEHAVIOR")>0 then
         printline=false
      end if
      
      if instr(thislineup,"MTSTRANSACTIONMODE")>0 then
         printline=false
      end if
   end if



   thisline=replace(thisline,chr(9),tabreplacer)

   firstbit=mid(thisline,1,3)
   firstbit=replace(firstbit," ","&nbsp;&nbsp;")
   thisline=firstbit & mid(thisline,4)

   if printstatus="y" and printline=true then
      response.write "<font color=""#FF0000"">" & counter & pad & "</font>&nbsp;&nbsp;&nbsp;"
   end if
      
   if printline=true then
      response.write thisline & "<br>" & vbcrlf
       end if
   
   printline=true
loop

response.write ("</font>")
a.Close
set a=nothing
set fs=nothing
%>

The Organization Library Table of Contents PrintView
<Previous> Tutorials - Showing Code

Organizing with TOCs, Next/Prev <Next>

CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>