We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22448
    • 241 Posts
    Got a couple of issues that I have been strugling with in Modx 2.3.1

    Issue 1.
    I was trying to build a Mega Menu with 2 types of drop downs and defined a tv called menu_type with the following values: Dropdown==1||Megamenu==2. Some pages needed a multi-column menus while others looked better with a simple drop down list.
    Then i used out put filter to insert the correct class like so:
    [[+menu_type:eq=`1`:then=`dropdown`:else=`mega-menu-item`]]

    The problem is that [[+menu_type]] had a proper value in &rowTpl chunk but not in &innerTpl chunk. Since innerTpl should be called on the same level as the row item i don't understand why tv placeholder lost its value.
    Any ideas hot to make WF not loose placeholder value in the same iteration?

    Issue 2.
    Trying to build an accordion with a 2 level wayfinder call i needed to use wf.id to uniquely mark accordion panels.
    Here's &rowTpl html:
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title [[+wf.classnames]]">
                <a href="#[[+wf.id]]" data-toggle="collapse" data-parent="#accordion2">
                    <i class="fa fa-medkit"></i>[[+wf.linktext]]<i class="fa fa-angle-down pull-right"></i>
                </a>
            </h4>
        </div>
        <div id="[[+wf.id]]" class="panel-collapse collapse [[+wf.classnames:eq=`active`:then=`in`]]">
            <div class="panel-body">
            [[+wf.wrapper]]
            </div>
        </div>
    </div>


    According to Wayfinder rtfm page:
    wf.id - outputs a unique ID attribute. You will need to specify the &rowIdPrefix parameter in order for this placeholder to receive a value. The value is your prefix + the docId.
    So i expected to get just prefix1234, but instead [[+wf.id]] output id="prefix1234". This is unexpected and undesired behavior. It should be up to the template to specify which attribute to insert the id value into.
    [ed. note: outre99 last edited this post 9 years, 8 months ago.]
    • Exactly like it says, it creates "a unique ID attribute". You can get a unique level marker with &levelClass which perhaps behaves more in the manner you are expecting.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 22448
        • 241 Posts
        Answering my own Issue 2.
        In core/components/wayfinder/wayfinder.class.php on line 316 we see this...
        if ($this->_config['rowIdPrefix']) {
                    $useId = ' id="' . $this->_config['rowIdPrefix'] . $resource['id'] . '"';
                } else {
                    $useId = '';
                }


        removing ' id="'. and .'"' solves the problem. Now I hope that this fix will be included in the next wayfinder release.
          • 22448
          • 241 Posts
          Thanks Susan. I thought about using level but since all of the accordion panels are on the same level the id's won't be unique. I've updated the original post to show html to illustrate the problem.

          And thank you for being the most responsive poster on MODx forums. You've helped me and many others to find our way through MODx. [ed. note: outre99 last edited this post 9 years, 8 months ago.]