Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sitemap treeview help

Status
Not open for further replies.

wpattison3

Programmer
Oct 4, 2005
1
US
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:
 
You should hit the forum search for treeview, I have posted some replies that go from fairly short to approaching book to free source code to two differant versions of TreeView classes on the matter.

I'd post more here but I'm too lazy to retype some of those posts (and don't have the source handy on this machine).

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top