1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<beginfold id='1'><%</beginfold id='1'> 'kate: hl ASP;
<beginfold id='2'>if</beginfold id='2'> ( instr(request.servervariables("PATH_INFO"),"login.asp") <= 0 and instr(request.servervariables("PATH_INFO"),"inset") <= 0 and instr(request.servervariables("PATH_INFO"),"Data") <= 0 and instr(request.servervariables("PATH_INFO"),"dropDown") <= 0 ) then
Session("originalRequestedPage") = Request.ServerVariables("PATH_INFO") & "?" & Request.ServerVariables("QUERY_STRING")
<endfold id='2'>end if</endfold id='2'>
<beginfold id='3'>function</beginfold id='3'> countRecords( rsToCount )
numRecs = 0
<beginfold id='4'>do</beginfold id='4'> until rsToCount.eof
numRecs = numRecs + 1
rsToCount.movenext
<endfold id='4'>loop</endfold id='4'>
rsToCount.close ' just to make sure nobody
' tries to operate on the recordset,
' which has already reached eof
countRecords = numRecs
<endfold id='3'>end function</endfold id='3'>
<beginfold id='3'>function</beginfold id='3'> unique( rs, sortColumn ) ' return unique instances of text in sortColumn within rs
dim sorted()
redim sorted(1)
dim i
i = 0
<beginfold id='4'>do</beginfold id='4'> until rs.eof
<beginfold id='2'>if</beginfold id='2'> (not find( rs(sortColumn), sorted )) then
redim preserve sorted(i+1)
sorted(i) = rs(sortColumn)
i = i + 1
<endfold id='2'>end if</endfold id='2'>
rs.MoveNext
<endfold id='4'>loop</endfold id='4'>
redim preserve sorted(i-1) ' the function will add an extra blank entry to the array
rs.Close ' close the recordset - we'll be using it again - and reset i - well be using it again, too
unique = sorted
<endfold id='3'>end function</endfold id='3'>
<beginfold id='5'>sub</beginfold id='5'> testSub( variable ) ' do nothing impressive...
dim newVar
newVar = variable
<beginfold id='2'>if</beginfold id='2'> ( variable = true )
response.end
<endfold id='2'></endfold id='2'><beginfold id='2'>else</beginfold id='2'> <endfold id='1'>%></endfold id='1'>
<p>We are writing text.</p>
<p class="stuff"><beginfold id='1'><%</beginfold id='1'>=newVar<endfold id='1'>%></endfold id='1'></p>
<p>We have written text and outputted a variable.</p>
<beginfold id='1'><%</beginfold id='1'> <endfold id='2'>end if</endfold id='2'>
<endfold id='5'>end sub</endfold id='5'> <endfold id='1'>%></endfold id='1'>
|