We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33101
    • 46 Posts
    I have an site that is using the modx api to pull in some look and feel/snippets from the modx part of the site to the non-modx part of the site. I’m pulling in the content like this

        $result = $modx->getTemplateVarOutput(array('RightSideNav'),8);
        echo $modx->parseDocumentSource($result['RightSideNav']);
    


    And I noticed that uncached snippets do get run - then I found the reason. in document.parser.class.php in the eval_snippets function is

          preg_match_all('~\[\[(.*?)\]\]~', $documentSource, $matches);


    should this also match for [! !]? I solved our problem by adding a str_replace to change [!->[[ and !]->]]

    Is it supposed to only match for [[]] and not [!!]? If someone knows of a "better" way of doing what this code does that bypasses this problem, I’d be interested.



    Thanks,
    Yehosef
      • 22303 MODX Staff
      • 10,725 Posts
      Uh, cacheable snippets [[ ]] are executed before page content is cached. Non-cacheable [! !], stangely enough, is not parsed until after the content to be cached is prepared. This is why [! !] already gets rewritten to [[ ]] in the final output content stage.