We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23571
    • 223 Posts
    I am using the code below in a Template Variable to retrieve the contents of doc ID of 76. The document contents are a line separated list that will reflect a selection of authors. This portion works just fine.

    @EVAL $doc = $modx->getDocumentObject('id', 76); $list = $doc['content']; $listTV = str_replace("\r\n", "||", $list); return $listTV;


    Now, I am intending for my list (ID76) to be created with a Ditto snippet that reflects the page titles within my directory with doc ID 68 (authors). By itself, this works just fine.

    [!Ditto? &startID=`68` &tpl=`ditto_authors`!]


    The problem I am having is that my TV displays my Ditto code instead of the output of the Ditto snippet. So, my question is, what is the best method for having my Ditto snippet execute so that the TV is populated appropriately?
      • 33962
      • 13 Posts
      Hi, don’t know if i understand it right.
      Maybe you could create your TV like this
      @EVAL return $modx->runSnippet(’getAuthors’);
      and put everything you need in a snippet.
        • 23571
        • 223 Posts
        many thanks to @einsteinsboi. the solution below replaced my code in the TV:

        @EVAL return str_replace("\r\n", " || ", $modx->runSnippet('Ditto', array('startID' => '68', 'tpl' => 'ditto_authors')));




          • 8609
          • 607 Posts
          Quote from: pleth at Apr 27, 2009, 11:53 AM

          many thanks to @einsteinsboi. the solution below replaced my code in the TV:

          @EVAL return str_replace("\r\n", " || ", $modx->runSnippet('Ditto', array('startID' => '68', 'tpl' => 'ditto_authors')));






          ummm, I think you meant @swscripts - he was the man with the solution  grin

          I’m not that good yet  shocked
            • 27361
            • 8 Posts
            Heh, thanks einsteinsboi, I could have gone with a bit longer solution, but I wanted to get the line into a single tweet. grin
              • 23571
              • 223 Posts
              Yes, @swscripts. Thank you!