modxmodx-templates

How to create Dynamic Menu in Modx


I want to create a e-commerce in Modx CMS. I have create dynamically everything in Modx, but i am not able to create dynamic menu.

How can i do this?


Solution

  • Here’s the contents of the myWrapperTpl chunk:

     <ul[[+outerClasses:notempty=` class="[[+outerClasses]]"`]]> [[+output]]</ul>
    
    <li[[*id:is=`[[+id]]`:then=` class="active"`]]>
        <a href="[[~[[+id]]]]">
            [[+menutitle:default=`[[+pagetitle]]`]]
        </a>
        [[[[+level:lt=`[[+maxLevel]]`:then=`getResources@main-menu? &parents=`[[+id]]` &level=`[[+level:add]]``:else=`-`]]]]
        </li>