ASP Developing for Academic and Business Processes Page 5

Next is the heart of the loop for data, when the line count gets to 41, it inserts the coding to begin a new column or falls into the standard loop and outputs a line. It also adds the topic to the meta tags list on the way through the loop. As with most coding, the end conditions are what take all the work. Each field is trimmed as it's used, and the string is output. For dynamic content creating a table won't allow the client to see anything until the table is closed, but here it's being used for file creation so is not important.

if paging = 41 then
    if trim(rsInput.Fields("topic")) <> "" then
      metatopics = metatopics & trim(rsInput.Fields("topic")) & ";"
    end if
  aline = trim(rsInput.Fields("topic")) & "  " & trim(rsInput.Fields("subtopic")) & "  "
  if trim(rsInput.Fields("pages")) <> "" then
  aline = aline & "-- " & trim(rsInput.Fields("pages")) & "<br>"
  aline = aline & "<br>"
  end if
  aline = ""
end if

And then finishing the page after it runs out of input...

if rsInput.EOF then
  paging = 81
    output.writeline("<p><center><table cellpadding=4 cellspacing=2 width='10%'><tr><td align=center bgcolor=silver><a href='" & htmlPrev & "'><font face='Comic Sans MS' size='4'>Previous</font></a></td><td align=center bgcolor=silver><a href='csfa_001.asp'><font face='Comic Sans MS' size='4'>Start</font></a></td>")
    output.writeline("<font size=1>Dynamic Content Resources by<br><a href='http://www.mallard-design.com/'>Mallard Design Company</a></font>")
end if


At this point, the page is full and the meta tag list is ready to output to a file for adding to the page on the second pass. The was a conscious choice, in other cases it would be better to store the page and add the list as final output. In this case a lot of the entries have commas, which need replacement before the topic can be used as a meta tag keyword. It's simpler here to open the finished file and globally change the entries into meta tag format and then paste them into the page.

This article was originally published on Jan 25, 1999

Thanks for your registration, follow us on our social networks to keep up-to-date