ASP Menu driving me insane
Posted
by simplesimon
on Stack Overflow
See other posts from Stack Overflow
or by simplesimon
Published on 2009-12-05T02:05:53Z
Indexed on
2010/04/09
11:03 UTC
Read the original article
Hit count: 335
Hi there,
I am trying to create a menu using ASP (I have never used ASP before, im a PHP man) using values stored in a database.
basically the html layout i want is as such:
<ul>
<li>
<ul class="sub-menu">
<li class="sub-menu-li">Test</li>
</ul>
</li>
</ul>
I need to loop around the root menu items rs("AD_Level") which is equal to 0 for root objects, then inside that loop, lop around anything that has the same parent id eg if the current record is AD_Level =0 and AD_Parent=5 then loop around all items with AD_Parent 5 and AD_Level != 0 and insert the values into html and so on and so forth.
Please help! I am struggling with a new language and cannot see a way to do this without losing sanity
Edit (Extracted from Comment by OP)
while not rsAdmin.eof
sPar = rsAdmin("ad_parent"
if rsAdmin("AD_Level")=0 then
while not rsAdmin2.eof
if rsAdmin2("AD_Level")<>0 and rsAdmin2("ad_parent")=sPar and rsAdmin2("AD_Sec_Level")=>2 then
response.write rsAdmin("AD_Menu")
end if
rsAdmin2.movenext
wend
end if
'' # if not rsAdmin.eof then sPar=rsAdmin("AD_parent") rsAdmin.movenext
wend
that is my code
© Stack Overflow or respective owner