wpattison3
Programmer
i need help with building a sitemap using ASP and SQL.
The problem isn't that the below doesn't work, it does. The problem is our sitemap is too big and I need to break it up. My objective is to output the categories only and when user clicks on a categorie the resulting proucts display similar to a tree view.
your contribuitons are appreicated in advance.
CODE:
**************************************
<%Option Explicit%>
<!--#include file="shop$db.asp"-->
<!--#include file="shopproductfeatures.asp"-->
<!--#include file="shopconvertcurrency.asp"-->
<!--#include file="shopcustomerprices.asp"-->
<!--#include file="shopproductformat.asp"-->
<!--#include file="shopreviewaverage.asp"-->
<!--#include file="shopproductcreatesql.asp"-->
<!--#include file="shopproductformat_template.asp"-->
<!--#include file="shopfileio.asp"--><%
response.buffer = false
function StripHTML( byref asHTML)
Dim loRegExp ' Regular Expression Object
' Create built In Regular Expression object
Set loRegExp = New RegExp
loRegExp.Global = True
' Set the pattern To look For HTML tags
loRegExp.Pattern = "<[^>]*>"
' Return the original String stripped of HTML
StripHTML = loRegExp.Replace(asHTML, "")
' Release object from memory
Set loRegExp = Nothing
End function
ShopPageHeader ' normal page header
%><h1>Sitemap</h1><%
Dim Dbc
dim sql_product
dim rs_product
dim CurrentCategory
dim ProductName
Shopopendatabase dbc
sql_product = "SELECT products.catalogid, products.Cname, " & _
" Categories.Catdescription " & _
" FROM products inner join Categories on Categories.Categoryid = products.ccategory" & _
" Order by Categories.Catdescription, products.Cname ASC"
set rs_product = dbc.Execute( sql_product )
CurrentCategory = ""
do while rs_product.eof = false
if CurrentCategory <> rs_product("Catdescription") then
response.write "<h2>" & rs_product("Catdescription") & "</h2>" & vbcrlf
CurrentCategory = rs_product("Catdescription")
end if
ProductName = UCase(Left(rs_product("Cname"), 1)) & LCase(Mid(rs_product("Cname"), 2))
ProductName = StripHTML( ProductName )
%><a href="/shopexd.asp?id=<%=rs_product("catalogid")%>" style="padding-bottom:3px; "><%=ProductName%></a><br>
<%
response.write vbcrlf
rs_product.movenext
loop
shopclosedatabase dbc
ShopPageTrailer ' normal trailer
%>
**************************************
/CODE:
The problem isn't that the below doesn't work, it does. The problem is our sitemap is too big and I need to break it up. My objective is to output the categories only and when user clicks on a categorie the resulting proucts display similar to a tree view.
your contribuitons are appreicated in advance.
CODE:
**************************************
<%Option Explicit%>
<!--#include file="shop$db.asp"-->
<!--#include file="shopproductfeatures.asp"-->
<!--#include file="shopconvertcurrency.asp"-->
<!--#include file="shopcustomerprices.asp"-->
<!--#include file="shopproductformat.asp"-->
<!--#include file="shopreviewaverage.asp"-->
<!--#include file="shopproductcreatesql.asp"-->
<!--#include file="shopproductformat_template.asp"-->
<!--#include file="shopfileio.asp"--><%
response.buffer = false
function StripHTML( byref asHTML)
Dim loRegExp ' Regular Expression Object
' Create built In Regular Expression object
Set loRegExp = New RegExp
loRegExp.Global = True
' Set the pattern To look For HTML tags
loRegExp.Pattern = "<[^>]*>"
' Return the original String stripped of HTML
StripHTML = loRegExp.Replace(asHTML, "")
' Release object from memory
Set loRegExp = Nothing
End function
ShopPageHeader ' normal page header
%><h1>Sitemap</h1><%
Dim Dbc
dim sql_product
dim rs_product
dim CurrentCategory
dim ProductName
Shopopendatabase dbc
sql_product = "SELECT products.catalogid, products.Cname, " & _
" Categories.Catdescription " & _
" FROM products inner join Categories on Categories.Categoryid = products.ccategory" & _
" Order by Categories.Catdescription, products.Cname ASC"
set rs_product = dbc.Execute( sql_product )
CurrentCategory = ""
do while rs_product.eof = false
if CurrentCategory <> rs_product("Catdescription") then
response.write "<h2>" & rs_product("Catdescription") & "</h2>" & vbcrlf
CurrentCategory = rs_product("Catdescription")
end if
ProductName = UCase(Left(rs_product("Cname"), 1)) & LCase(Mid(rs_product("Cname"), 2))
ProductName = StripHTML( ProductName )
%><a href="/shopexd.asp?id=<%=rs_product("catalogid")%>" style="padding-bottom:3px; "><%=ProductName%></a><br>
<%
response.write vbcrlf
rs_product.movenext
loop
shopclosedatabase dbc
ShopPageTrailer ' normal trailer
%>
**************************************
/CODE: