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

    I need to get document content from snippet use this code
    $doc=$modx->getObject('modDocument', $id);
    echo $doc->process();
    


    This code return only template without any TV parameters and content.
    For example, if I have template
    "text": "[[*content]]"
    

    Snippet returns
    "text": ""
    


    How can I get full document output from snippet?

      • 10208 ☆ A M B ☆
      • 1,780 Posts
      What exactly are you trying to do, and where?

      Where is the snippet call? Are you trying to pull a whole "page's" output into another resource with the *content tag? (that won't work btw).

      The content tag is not associated with the template's TV's and won't, by itself produce anything other than what is in the content field in a resource. If you're wanting to get the content from a resource (or resources) and display it in another resource (regardless of template) and maintain TV output, you can do that with getResources (see package management).

      Additionally, I am pretty sure that "echo" should be "return" in your snippet code. Although if you're looking to produce what I think you are, you don't need it. I could be entirely wrong though.
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 3749
        • 24,544 Posts
        This might be what you're looking for (or not): http://rtfm.modx.com/display/ADDON/getResourceField
          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
          • 42342
          • 5 Posts
          I need to get full template output for first document first template, for second document - second. Each template has individual parameters.
            • 42342
            • 5 Posts
            getResources uses one chunk to render document list, I need to use for each document self-attached template
              • 10208 ☆ A M B ☆
              • 1,780 Posts
              Yeah, I'm still confused. Which is normal.

              What do you mean by document and template?

              i.e. does Document=Page=Resource? (resource being a page, or document in the resource tree)

              and for template, you are referring to a MODX element, a Template that is associated with a Resource(page/document)?

              Are you looking to produce a list of links, and/or content from fields and TV's? Or complete page renders of the resource including the template and then another complete page render of a different resource and template?

              Checking again... yep. Still confused :~}
                Frogabog- MODX Websites in Portland Oregon
                "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
                Having server issues? These guys have MODX Hosting perfected - SkyToaster
                • 42342
                • 5 Posts
                I can get 'modDocument' or 'modResource'. I mean the document is page with attached template and show in frontend and I need to get this page content (with TVs) which user can see in frontend, but I need to get it in my snippet
                  • 3749
                  • 24,544 Posts
                  Ah. In that case this might be what you want: http://rtfm.modx.com/display/ADDON/renderResources
                    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
                    • 42342
                    • 5 Posts
                    That's it! Thank you very much!