Skip to main content
Kinetic Community

Christmas Bonus

Screen Shot 2016-05-05 at 12.08.38 PM.png

Steps:

  1. Create foundation data

  2. Add page and remove code block

  3. Add new code

  4. Add a partial

Create the foundation data

  1. Create the following categories: “Hardware”, “Software”, “Applications”, “Laptops”, and  “Desktops”
  2. Create category Attribute Definition: “Parent”
  3. Add the “Parent” attribute to “Applications” and enter “software” for the Value. Save the category.
  4. Add the “Parent” attribute to both “Laptops” and  “Desktops” and enter “hardware” as the Value. Save the category.

Add the page that will hold your categories and remove code block

  1. In the pages directory, copy the categories.jsp page and name the copy nested.jsp.
    copy/paste/rename
  2. Do a search for grid.
  3. Highlight and remove everything between the div's (including the div's that have the class "grid".)
<div class="grid">
    <c:forEach var="category" items="${kapp.categories}">
    …
    </c:forEach>
</div>

 Add new code

  1. Add the following code where you removed the last block:
<ul>
    <c:forEach var="category" items="${CategoryHelper.getCategories(kapp)}">
        <li>
            ${text.escape(category.getName())}
            <ul>
                <%-- Recursive Subcatgegories --%>
                <c:set scope="request" var="currentCat" value="${category}"/>
                <c:import url="${bundle.path}/partials/subCategory.jsp" charEncoding="UTF-8" />
            </ul>
        </li>
    </c:forEach>
</ul>
  1. Save the file.

Add the partial that will display your subcategories:

  1. In the partials directory, copy the categoryNav.jsp and name the copy subCategory.jsp.
  2. Find this line at top of the file.
<%@include file="../bundle/initialization.jspf" %>
  1. Remove everything below the line you found in step 2.
  2. Add the following code.
<c:forEach var="subcategory" items="${currentCat.getSubcategories()}">
    <li>
        ${text.escape(subcategory.getName())}
        <ul>
            <c:set var="currentCat" value="${subcategory}" scope="request"/>
            <jsp:include page="subCategory.jsp"/>
        </ul>
    </li>
</c:forEach>
  1.  Save the file.