Postby sumit784 » Thu Jul 16, 2015 10:57 pm
Use this code in you "Nav.html"
----------------------------------------------------------------
<nav>
<div th:remove="all">
<!-- This template displays the navigation of the site by looking up the category named "Nav"
and building a list of the categories sub-categories.
-->
</div>
<blc:categories resultVar="navCategories" parentCategory="Primary Nav" maxResults="8" />
<ul> <!-- Default Navigation Bar-Main Menu -->
<li th:each="category : ${navCategories}" th:unless="${#strings.isEmpty(category.url)}">
<a class="home" th:href="@{${category.url}}" th:class="${categoryStat.first}? 'home'" th:text="${category.name}"></a>
<!-- First level -->
<ul th:if="${#objects.nullSafe(category,default)}" class="first-level-menu">
<li th:each="cat : ${category.getChildCategories()}">
<a th:text="${cat.name}" th:href="@{${cat.url}}"></a>
<!-- Second level -->
<ul th:if="${#objects.nullSafe(cat,default)}" class="second-level-menu">
<li th:each="cat1 : ${cat.getChildCategories()}">
<a th:text="${cat1.name}" th:href="@{${cat1.url}}"></a>
<!-- Third level -->
<ul th:if="${#objects.nullSafe(cat1,default)}" class="third-level-menu">
<li th:each="cat2 : ${cat1.getChildCategories()}">
<a th:text="${cat2.name}" th:href="@{${cat2.url}}"></a>
<!-- Fourth level -->
<ul th:if="${#objects.nullSafe(cat2,default)}" class="third-level-menu">
<li th:each="cat3 : ${cat2.getChildCategories()}">
<a th:text="${cat3.name}" th:href="@{${cat3.url}}"></a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
-------------------------------------------------------------
Thanks,
Sumit Rathore