Quantcast
Channel: Adobe Community : Popular Discussions - CQ5 (read only)
Viewing all articles
Browse latest Browse all 12476

Menu and Sub Menu link

$
0
0

Hi, I just started to learn Adobe CQ

 

I have site navigation bar which has 5 items and each navigation item will have sub items. I added text to both the navigation item and sub item but not sure how to link a a particular sub item to a nav item. When I add text in a sub nav item there is no way to say a particular sub item should fall under a navigation item. Can you please let me know if there is a way to accomplish this?

 

I have created two components one for navigation item and the second one for sub navigation item. And my code looks like this

 

header.jsp

<cq:include path="navitem" resourceType="stripe/components/modular/navdropdownitem"/>

<cq:include path="navitem" resourceType="stripe/components/modular/navdropdownitem"/>

 

 

navdropdownitem.jsp -- first component

 

<div class="nav-collapse collapse" style="margin-left: 115px; float:left;">

    <ul class="nav" style="color: #ffffff;">

        <li class="dropdown">

            <cq:include path="iparnavitem" resourceType="foundation/components/iparsys"/>

            <a href="#" class="dropdown-toggle" data-toggle="dropdown">

                <%=navitem%>

            </a>

            <cq:include path="parnavsubitem" resourceType="foundation/components/parsys"/>

            <ul class="dropdown-menu">

            <%

            String[]  navsubitems = (String[])request.getSession().getAttribute("navsubitems");

            if(navsubitems != null)

            {

                for(int i=0;i<navsubitems.length ;i++)

                {

            %>

                  <li><a href="#"><%=navsubitems[i]%></a></li>

            <%   

                }

            }

            %>

            </ul>

        </li>

    </ul>

</div>     

 

navdropdownsubitem.jsp

 

<%

        String[]  navsubitem= properties.get("navsubitem", String[].class);

        HttpSession session = request.getSession();

        session.setAttribute("navsubitems", navsubitem);

%>

 

 

Appreciate your help

 

Thanks

Sridhar


Viewing all articles
Browse latest Browse all 12476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>