ASP Database Driven Menu and alt_url

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
steveclements
Beginner
Beginner
Posts: 4
Joined: Wed Apr 07, 2004 11:24 am

ASP Database Driven Menu and alt_url

Post by steveclements »

I am struggling to adapt some code to allow the parent menu to have a link as well as submenus. Looking though the forums I have found the alt_url entry but cannot get the menu to work. The code (found on the this forum) is below, I have added the code (in red) which should work but doesn't!!

Can anybody help with where I'm going wrong?

--------Start of Code ----------

<%
dim oConnect, oMenuRoot, oSub
Set oConnect = Server.CreateObject("ADODB.Connection")
oConnect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("\milonic\monmenu\db.mdb") & ";"
set oMenuRoot = oConnect.execute("selectTOCroot")
set oMenuSub = oConnect.execute("selectTOCsub")
'ROOT MENU
do until oMenuRoot.eof
response.write ",""" & oMenuRoot("label") & ""","""
if oMenuRoot("sub") then
response.write "show-menu=" & oMenuRoot("id") & ", """& oMenuRoot("link") & """
else
response.write oMenuRoot("link")
end if
response.write """,,"""",1" & vbcrlf
oMenuRoot.movenext
loop
set oMenuRoot = nothing
'SUB MENUS
do until oMenuSub.eof
if intOldTree<>oMenuSub("parent") then
blnNewTree=true
response.write "])" & vbcrlf
else
blnNewTree=false
end if
if blnNewTree then
response.write "addmenu(menu=[""" & oMenuSub("parent") & """," & vbcrlf & ",,120,1,"""",style1,,""left"",effect,,,,,,,,,,,," & vbcrlf
end if
response.write ",""" & oMenuSub("label") & ""","""
if oMenuSub("sub") then
response.write "show-menu=" & oMenuSub("id")
else
response.write oMenuSub("link")
end if
response.write """,,,1" & vbcrlf
intOldTree=oMenuSub("parent")
oMenuSub.movenext
loop
response.write "])" & vbcrlf
set oMenuSub = nothing
%>
Post Reply