We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9102 ☆ A M B ☆
    • 318 Posts
    Oh.... That's cool, I didn't know that.
      • 9102 ☆ A M B ☆
      • 318 Posts
      Awesome -- I got the getChunkIf snippet to work -- but only when called cached (why doesn't it work when called uncached?) and only if I substitute this:
      if (!empty($scriptProperties['placeholder'])){
          $subject = $modx->getPlaceholder($scriptProperties['placeholder']);
      }
      

      for this:
      if (!empty($scriptProperties['placeholder'])){
          $subject = '[[+'.$modx->getPlaceholder($scriptProperties['placeholder']).']]';
      }
       
      $modx->parser->processElementTags('',$subject,true,true);
      

      I'm pretty sure the latter is just a typo, as you can also substutute:
      if (!empty($scriptProperties['placeholder'])){
          $subject = '[[+'.$scriptProperties['placeholder'].']]';
      }
       
      $modx->parser->processElementTags('',$subject,true,true);
      

      And it also works.

      Anyway, I'm stoked, I bet this is quite a bit more efficient than the other method I was using.
        • 36782
        • 109 Posts
        @freejung:
        This is great stuff!
        As a quasi-beginner, being involved in this discussion has improved my MODx snippet development quite a bit.
        Thanks for posting smiley