We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3806
    • 6 Posts
    Hi,

    I need to be able to evaluate documents embedded into a parent document. This should be used for sideBars where each element in my sideBar is a document and a template. So in a way a sidebar element is a stand alone page

    So during the normal generation of my output, I will fetch some sidebars documents and evaluate these. My first try was to use ajax, where I inserted calls to the sidebar pages, but this failed when the page contained a document.write in javascript. So therefore I’m looking for an alternative solution.

    My next try would be to create a special parser class by inheriting from documentParser and then override getDocumentIdentifier(). Would that be possible or should some special precautions be taken. I would then supply the id identifying my sidebar page, instead of reading the page from the request.

    Best Regards
    Niels
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That’s what TVs are for. If you still feel that you must "extend" the parser, look into plugins.
        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
        • 3806
        • 6 Posts
        Hi,

        I think I have formulated me a bit unprecise. I did not mean ’extend’, but ’inherit.

        I’m aware of that you can bind documents to a template variable, but I did look through the code and it seems to me that you only fetch the content of the document. I need the document renderered including the template that are assigned to the document, which why was I dropped that approach.

        Best Regards
        Niels
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The document goes through the parser up to 10 times. If the TV value that is inserted contains other MODx tags they will get processed in the next pass through the parser.
            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