Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


dynamic left side navigation from database

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,43929
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> dynamic left side navigation from database
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 dynamic left side navigation from database - 3/1/2007 1:30:27 AM   
  hadib

 

Posts: 1
Score: 0
Joined: 3/1/2007
Status: offline
hi guys, im tryin to create a left side navigation menu that will run from a database. this will have main categories and sub categories.
i've managed to get the first category to show but i need the process to repeat in order to see the other categories and their sub categories.
im a beginner so excuse my coding can anyone help???

this is what i've got so far

---------------------------------------
<!--#include file="Connections/pro3.asp" -->
<%
Dim catRS__MMColParam
catRS__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then
catRS__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim catRS
Dim catRS_numRows
Set catRS = Server.CreateObject("ADODB.Recordset")
catRS.ActiveConnection = MM_pro3_STRING
catRS.Source = "SELECT DISTINCT category  FROM product  WHERE onlinestatus = '" + Replace(catRS__MMColParam, "'", "''") + "'  ORDER BY category ASC"
catRS.CursorType = 0
catRS.CursorLocation = 2
catRS.LockType = 1
catRS.Open()
catRS_numRows = 0
%>
<%
Dim subcatRS__MMColParam
subcatRS__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then
subcatRS__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim subcatRS
Dim subcatRS_numRows
Set subcatRS = Server.CreateObject("ADODB.Recordset")
subcatRS.ActiveConnection = MM_pro3_STRING
subcatRS.Source = "SELECT category, subcategory FROM categories WHERE visible = " + Replace(subcatRS__MMColParam, "'", "''") + " ORDER BY location ASC"
subcatRS.CursorType = 0
subcatRS.CursorLocation = 2
subcatRS.LockType = 1
subcatRS.Open()
subcatRS_numRows = 0
%>
<% If Category = "home" THEN %>
<font color="red"><b>Home</b></font><br><br>
<% ELSE %>
<a href="default.asp?Category=home">Home</a><br><br>
<% END IF %>

<% Response.Write((catRS.Fields.Item("category").Value)&"<br>")
WHILE (subcatRS.Fields.Item("category").Value) = (catRS.Fields.Item("category").Value)
Response.Write((subcatRS.Fields.Item("subcategory").Value)&"<br>")
subcatRS.MoveNext
WEND
%>
<% catRS.MoveNext %>


p.s. i will do the hyperlinks later when i've got round this problem

< Message edited by hadib -- 3/1/2007 2:51:12 AM >
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> dynamic left side navigation from database Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts