Developing from Chaos Page 8


Using ASP to Create a Website from Spreadsheets Continued

Finished with the product pages, but the catalog needs a heirarchy, so some asp pages were created to arrange several levels of indexes and also the pricing pages within the navigation schema. These are by product and group types. Then, the homepage was coded to be created from database sources to create drop-down select boxes by product or group. Since these two groupings rely on the same logic, slightly altered, here's the one for the index of product types.

set conn2 = server.createobject("Scripting.FileSystemObject")
htmlOut = "X:\webshare\wwwroot\gns\v1\type_price_00" & series & ".html"
set output = conn2.OpenTextFile(htmlOut, 8, True)
    ...typical html header and navigation response.write's go here...
set conn1 = server.createobject("ADODB.Connection")
conn1.open "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=X:\webshare\wwwroot\gns\cgi\gns_01.mdb"
set rsInput = server.createobject("ADODB.Recordset")
rsInput.open "product", conn1, 2, 3, 2
ptype = rsInput("prod_type")
tfooter = "<br><font size=1>Dynamic Content Resources by<br><a href='http://www.mallard-design.com/'>Mallard Design Company</a> ©1999</font><hr><p><a href=""#page_top"">To Top of Page</a>"
while not rsInput.EOF
series = series + 1
if (rsInput("prod_type") = ptype) or (series < 2) then
lines = lines + 1
output.writeline("<tr><td align=center>" & lcase(rsInput("prod_type")) & "</td><td align=""center"" bgcolor=""#ccffff""><a href=""" & rsInput("prod_page") & """ target=_top><font face='verdana,arial,helvetica' size=2>" & rsInput("prod_model") & "</font></a></td><td><font size=1>" & rsInput("part_number") & "</font></td><td align=""center"" bgcolor=""#eaeaea"">" & rsInput("description") & "</td><td align=right>$" & formatnumber(rsInput("sin132_price"), 0, -2) & "</td></tr>")
'finish the page
output.writeline("<font size=2 color=000000 face=""Arial,Helvetica,Verdana"">Notes:</font><br>")
set conn1 = server.createobject("ADODB.Connection")
conn1.open "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=X:\webshare\wwwroot\gns\cgi\gns_01.mdb"
set rsTemp3 = server.createobject("ADODB.Recordset")
rsTemp3.open "notes", conn1, 2, 3, 2
while not rsTemp3.EOF
if not (rsTemp3("prod_type") = ptype) then
  if done = 0 then
    done = 1
  if not isnull(rsTemp3("note1")) then
    output.writeline("<font size=1 color=000000 face=""Arial,Helvetica,Verdana"">" & rsTemp3("note1") & "</font><br>")
    end if
    if not isnull(rsTemp3("note2")) then
      output.writeline("<font size=1 color=000000 face=""Arial,Helvetica,Verdana"">" & rsTemp3("note2") & "</font><br>")
    end if
    if not isnull(rsTemp3("note3")) then
      output.writeline("<font size=1 color=000000 face=""Arial,Helvetica,Verdana"">" & rsTemp3("note3") & "</font><br>")
    end if
  end if
end if

This article was originally published on Mar 28, 1999

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