i am trying to make a menu by passing the structur...
# lucee
g
i am trying to make a menu by passing the structure values along with nested structures i ended up somewhat but i am stuck on the inner nested struct where i have to loop over and set the values passed, in case the dashboard i am passing, the value is empty, i do not want any syubmenu but it is still showing up
e
cfscript> structData = { 'dashboard':'', 'page1' : { 'page1' : 'page1', 'page2' : 'page2' } } dump(structData); </cfscript> <cfoutput> <cfloop collection="#structData#" item="i"> <cfdump var="#i#"> <cfdump var="#structData[i]#"> <div class="sidebar-body"> <ul class="sidebar-body-menu"> <cfset MyMenu = "Dashboard"> <cfswitch expression="#myMenu#"> <cfcase value="Dashboard"> <li><a class="active" href="/"><span class="icon home" aria-hidden="true"></span>Dashboard</a> </li></cfcase> <cfdefaultcase><li> <a class="show-cat-btn" href="##"> <span class="icon document" aria-hidden="true"></span>#i# <span class="category__btn transparent-btn" title="Open list"> <span class="sr-only">Open list</span> <span class="icon arrow-down" aria-hidden="true"></span> </span> </a> <ul class="cat-sub-menu"> <li> <a href="posts.html">All Posts</a> </li> <li> <a href="new-post.html">Add new post</a> </li> </ul> </li> </cfdefaultcase> </cfswitch> </ul> </div> </cfloop> </cfoutput>
g
@Evil Ware Thanks for the reply but i am trying to make it like this https://prnt.sc/tmg6p0f4dRMq
ony concern is why the order is messed up while looping