<% Sub GetSubMenus(intMenuID, intLevel, intCounterx, bRSEnd) strSQL = "(SELECT *, 1 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "UNION "&_ "(SELECT *, 0 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID NOT IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "ORDER BY MenuOrder" set rsSubMenu = con.execute(strSQL) i_SubLoopCounter = 0 do while not rsSubMenu.EOF i_MenuID = rsSubMenu("MenuID") i_MenuSectionID = rsSubMenu("MenuSectionID") s_MenuName = rsSubMenu("MenuName") i_MenuOrder = rsSubMenu("MenuOrder") i_MainMenuID = rsSubMenu("MainMenuID") i_PageID = rsSubMenu("PageID") s_Frame = rsSubMenu("Frame") b_Subs = rsSubMenu("Subs") %> <%if b_ShowIcons then%>Edit Delete<%else%><%end if%>

<%if Not bRSEnd then%> <%else%> <%end if%> <%For y = 1 to intLevel%> <%if Not bRSEnd then%> <%else%> <%end if%> <%Next%> <%rsSubMenu.movenext%> <%if rsSubMenu.EOF then%> <%else%> <%end if%> <%if CInt(b_Subs) = 1 then%> <%else%> <%end if%> <%=s_MenuName%>

<%for i = 1 to intMaxCount%> <%if i = (intLevel + 2) then%> <%if b_ShowIcons then%><%if i_SubLoopCounter > 0 then%> Move Up <%else%> <% end if if not rsSubMenu.EOF then %> Move Down <%else%> <%end if%><%else%>

 

<%end if%> <%else%>

 

<%end if%> <%Next%> <%if b_ShowIcons then%><%if CInt(b_Subs) = 0 then%>

Link

<%else%>

 

<%end if%><%end if%> <%if CInt(b_Subs) = 1 then GetSubMenus i_MenuID, intLevel + 1, counterx, rsSubMenu.EOF%> <%i_SubLoopCounter = i_SubLoopCounter + 1%> <%loop End Sub %>