We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50923
    • 137 Posts
    I have simple template like this
    [[!If?
       &subject=`[[!ifIssetsGetInUrl? &name=`t`]]`
       &operator=`EQ`
       &operand=`0`
       &then=`[[*content]]`
       &else=`[[!getApiPageAlias? &t=`[[!getUrlParam? &name=`t` &int=`0`]]` &u=`[[!getUrlParam? &name=`u` &int=`0`]]` &e=`[[!getUrlParam? &name=`e` &int=`0`]]` &defaultcontent=`[[*content]]`]]`
    ]]
    


    It always goes in else??
    But if I do something like this

    [[!If?
       &subject=`[[!ifIssetsGetInUrl? &name=`t`]]`
       &operator=`EQ`
       &operand=`0`
       &then=`[[*content]]`
       &else=`YES`
    ]]


    It is working fine, where can be the problem?
      <a href="www.play2web.com" title="izrada web sajtova">Izrada web sajtova</a>
      • 3749
      • 24,544 Posts
      My guess is that the nested, uncached tags in the &else have not been parsed by the time when the outer else tag is parsed. Your code is not that simple. You have a snippet tag inside a snippet tag inside a snippet tag inside a chunk. Once you get to that level of nesting, things tend to break down.

      It's seems a remarkably complex way of doing what you want, since you're calling four separate snippets. You might consider one snippet something like this:


      $content = $modx->resource->get('content'));
      
      $output = '';
      
      if (isset($_GET['t'])) {
         $output = $content;
      } else {
          /* modified getApiPageAlias code here to set $output */
      }
      
      $output = empty($output)? $content : $output;
      
      return $output;
        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