tring & strtextfontend & vbcrlf
strreturnstring = strreturnstring & strtextdataend & vbcrlf
'///// send back constructed string /////////////////////////////
shownotes = strreturnstring
after the first two html style variables are set (strtitledatastart and strtitlefontstart), the code declares a local variable (lngnoteidindex) that will be used within the loop to see if the note that is currently being itinerated is the same note that was selected by the user. the user-sent lngnoteid is subtracted by one and stored in this lngnoteidindex variable. it is subtracted by one because our array is zero based and the database table starts with one rather than zero. we itinerate through the array by starting at the first item in the array, set at zero, and end with the last item in the array. the lngarraycount variable is used to indicate the end of the array by using the vb ubound() method.
'///// set selected noteid to array index (for not inserting the <a> tag)
lngnoteidindex = (lngnoteid - 1)
the first thing to do within the record-array looping code is to check if the noteid stored in the array, and currently being processed by the loop, matches the noteid selected by the user. if it's not the user-selected noteid, then we need to construct an html <a> tag that will link back to the asp file with a query string that indicates the noteid value of the title. an "if not lngnoteidindex = lngindexcount then" statement will fulfill this need since the lngindexcount variable value contains the current loop count.
'///// loop through array
for lngindexcount = 0 to lngarraycount
within the if/then statement the strurl is concatenated to the first part of the <a> tag and then a query string named "id" is assigned the noteid valued from the vrecordarray. double quotations marks are used to include quotation marks for the file name within the html <a> tag.
'///// include an <a> tag if not the selected noteid
if not lngnoteidindex = lngindexcount then
strreturnstring = strreturnstring & "<a href=""" & strurl
strreturnstring = strreturnstring & "?id=" & vrecordarray(array_note_id_index, lngindexcount) & """>"
end if
the two lines of code within this if/then process result in the following string, given that the current loop count is at 3 and it isn't the note that was selected by the user. since the <a> tag has been constructed, we'll add in the note title values.
<a href="noteexample.asp?id=3>
we again check to see if the current note within the loop is other than the user-selected note and end the <a> tag. an optional vbcrlf is added to the string for clearer html source-code reading.
'///// include the note title text from the array
strreturnstring = strreturnstring & vrecordarray(array_title_index, lngindexcount)
we'll also add a <br> so the note titles won't all end up on one line within the html table record.
'///// include an </a> tag if not the selected noteid
if not lngnoteidindex = lngindexcount then strreturnstring = strreturnstring & "</a>" & vbcrlf
this html table ends by adding the ending two html style variables (strtitlefontend and strtitledataend) to our return string.
'///// end the title line with a line break
strreturnstring = strreturnstring & "<br>" & vbcrlf
the second html table record is much simpler since it basically involves adding the two html style variables (strtextdatastart and strtextfontstart), the variable containing the selected note text (strnotetext), and the last two html style variables (strtextfontend and strtextdataend).
'///// include the beginning table data and font tags
strreturnstring = strreturnstring & strtextdatastart & vbcrlf
strreturnstring = strreturnstring & strtextfontstart & vbcrlf
'///// include the note text body
strreturnstring = strreturnstring & strnotetext & vbcrlf
'///// include the ending font table data tags
strreturnstring = strreturnstring & strtextfontend & vbcrlf
strreturnstring = strreturnstring & strtextdataend & vbcrlf
after that, the return string is ready to send back to the calling code.
'///// send back constructed string /////////////////////////////
shownotes = strreturns