We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 727
    • 502 Posts
    Where in the MODx code are the [~id~] tags parsed? $modx->parseDocumentSource doesn’t seem to do it, and I searched through document.parser.class.inc.php and couldn’t find a regex that does it.

    Any ideas? I’m writing a snippet that returns the content of a document and I need it to make sure these tags are parsed. Thanks!

    Andy
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      you want $modx->makeUrl()
        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
        • 727
        • 502 Posts
        So I guess I have to parse the document content myself, looking for the tags and replacing with the output of makeURL? I.e. there is no MODx API function that does this?

        Andy
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ah, ok then, it’s $modx->rewriteUrls($documentSource), line 873 of manager/includes/document.parser.inc.php. That’s not really supposed to be an external API, though, so I can’t promise its performance under different circumstances.
            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
            • 727
            • 502 Posts
            Thanks! I looked at the code and function looks simple enough in operation that it should work ok.

            Andy
              • 25663 MODX Staff
              • 12,272 Posts
              No promises that non-public/external/whatever-the-proper-name-is functions will be there in future (read 097) releases though.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 727
                • 502 Posts
                I hope if it is replaced there will be an equivalent. Being able to return parsed document content from a snippet is very useful. Or perhaps there is another way I should be doing it?

                Andy
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: Andy at Dec 12, 2007, 11:13 PM

                  I hope if it is replaced there will be an equivalent. Being able to return parsed document content from a snippet is very useful. Or perhaps there is another way I should be doing it?

                  Andy
                  This definitely will not be compatible with 0.9.7; that function is completely removed. In 0.9.7, there is source-order, recursive parsing, and there is one single method to process tags within content, regardless of what tag it is.
                    • 727
                    • 502 Posts
                    Great - one function for parsing sounds a lot better. smiley

                    Andy