We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52618
    • 10 Posts
    Have you tried this, notice the spaces in the &then param...
    [[If?
        &subject=`[[+id]]` 
        &operator=`inarray`
        &operand=`2,3,4,5`
        &then=`[$second-nav-item]]`
        &else=`<li id="[[+alias]]" class="[[+menutitle]]"><a href="[[~[[+id]]]]">[[+menutitle]]</a></li>`
    ]]
    

    Thanks smiley
      • 52618
      • 10 Posts
      Does it work when you try it out of a chunk e.g.
      [[If?
          &subject=`[[+id]]` 
          &operator=`inarray`
          &operand=`2,3,4,5`
          &then=`[[If? 
                          &subject=`[[+id]]`
                          &operator=`is`
                          &operand=`4`
                          &then=`
                          <li id="[[+alias]]" class="[[+menutitle]] parent aaaa"><a href="[[~[[+id]]]]">[[+menutitle]]</a>
                              <ul>
                                  <div class="sub-nav">
                                      [[$dropdown-nav? &parent-id=`[[+id]]`]]
                                  </div>
                                  <div class="nav-img">
                                      <img class="img-responsive" src="[[+tv.nav-banner]]" />
                                  </div>
                              </ul>
                          </li>`
                          &else=`
                          <li id="[[+alias]]" class="[[+menutitle]] parent bbbb"><a>[[+menutitle]]</a>
                              <ul>
                                  <div class="sub-nav">
                                      [[$dropdown-nav? &parent-id=`[[+id]]`]]
                                  </div>
                                  <div class="nav-img">
                                      <img class="img-responsive" src="[[+tv.nav-banner]]" />
                                  </div>
                              </ul>
                          </li>`
                      ]]`
          &else=`<li id="[[+alias]]" class="[[+menutitle]]"><a href="[[~[[+id]]]]">[[+menutitle]]</a></li>`
      ]]
      
      

      p.s sorry about the formatting.
        • 3749
        • 24,544 Posts
        If you're calling If more than once on the page, it has to be called uncached. Otherwise it will return the results of the first run from the cache every time.

        [[!If ... ]]


        I'm not sure it will work, because the ! will delay the processing of the snippet and the placeholders may not be set correctly.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting