CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 HTML List Sitemap in ASP

Print topic Send  topic

Author Message

Posts: 123
Posted: 12/26/2009, 4:05 PM

Hi there, Ive just made a small class, cSitemap to grab from the classic Menu table we use to generate complex navigations;

The tbMenu fields are: Menu_Id, Menu_Parent_Id, Title, h_ref

And the class code:

Class cSitemap  
Private oConn  
Private sList  
Private mList  
Private lId  
Private SQL  
Public Function Init  
	Set oConn = New clsDBcnx_te_front 'clase de codecharge connection  
End Function  
Public Function List(oSet)  
	If oSet.BOF and oSet.EOF Then  
	sList = sList & "<ul>" & vbLf  
	Do While Not oSet.EOF  
		If lid<>0 Then  
			sList = sList & "<li><a href='" & oSet.Fields("h_ref").Value & "'>" & oSet.Fields("Title").Value & "</a></li>"  
			'Recursive call  
			sList = sList & "<li>" & oSet.Fields("Title").Value & "</li>" & vbLf  
		End If  
	sList=sList & "</ul>" & vbLf  
	End If  
	List = sList  
End Function  
Public Function SubList(Parent_Id)  
	If IsNull(Parent_Id) Or Not IsNumeric(Parent_Id) Then  
	 SQL = "SELECT * FROM tbMenu WHERE 0=1"  
	 SQL = "SELECT * FROM tbMenu WHERE Menu_Parent_Id=" & Parent_Id  
	End If  
	Set SubList = CreateObject("ADODB.Recordset")  
	SubList.Open SQL, oConn.Connection  
End Function  
End Class  

Just drop it as an includable, then rename the connection accordingly, and you are ready to go; You just use it as this:

Dim oMap  
Set oMap = New cSitemap  

Where label1 should be set as HTML and 0 is my root cat, you could use any Id to show just one category.

Glad to share, comments welcome
Yes! I Can!!!
View profile  Send private message

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.