We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6144
    • 13 Posts
    I am trying to get the content of pages I have built to show up in other pages. Is there a specific call or snippet available where I can specify the page id and then have the content from a different page to show up?
      • 7231
      • 4,205 Posts
      have you tried out GetField snippet?
      http://www.modxcms.com/getField-667.html
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 26435
        • 1,193 Posts
        If you need additional info, like the page title for example, you could use the getDocument() method

        getDocument(int $documentID, string $fields, boolean $published)
        $document = $modx->getDocument(50, '*', 1);
        $title = $document['pagetitle'];
        $content = $document['content'];
        


        -sD-
        Dr. Scotty Delicious, Scientist DFPA.
          Husband, Father, Brother, Son, Programmer, Atheist, Nurse, Friend, Lover, Fighter.
          All of the above... in no specific order.


          I send pointless little messages
          • 29181
          • 480 Posts
          This sounds quite interesting...if I use a * will it also retrieve the TV’s of that document?

          I’ll have to take a look...

          Thanks,
          Taff

          [EDIT]

          getTemplateVarOutput is the baby I was after...I can even use it to retrieve other Document properties like content createdon etc etc

          Put this bit of code in a snippet to see it working...

          $doc_id = 1; //The document from which we want to retrieve the TVs
          $results=$modx-> getTemplateVarOutput("*", $doc_id);
          print_r($results);
          


          Thanks for the pointer though Scotty.

          [/EDIT]
            Adrian Lawley: www.adrianlawley.com
            • 727
            • 502 Posts
            Create a template variable and use the @DOCUMENT binding.

            Andy