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

    This is a noob question, but how can I get the contents of a template (not a resource), using xPDO?

    I tried using the following:

    $template = $modx->getObject('modElement',784);
    $output = $template->getContent();


    And also:

    $output= $modx->getObject('modTemplate',784);


    Neither works :-(
      • 4172
      • 5,888 Posts
      what about

      if ($template = $modx->getObject('modTemplate',784)){
          $output = $template->getContent();
      }

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 43746
        • 10 Posts
        Quote from: Bruno17 at May 12, 2014, 07:40 AM
        what about

        if ($template = $modx->getObject('modTemplate',784)){
            $output = $template->getContent();
        }



        Yep, that did the trick, thanks Bruno, much appreciated!