Good day.

Question to those who worked on Modx and wrote snippets.
I wrote this code in the snippet:

<?php echo "Сниппет PrintChunk работает!"; $output = $modx->getChunk($chank); return $output; 

I created such a parameter $chank and then call it as follows:

 [[!PrintChunk? &chank=`tell_my`]] 

And derives nothing from the chunk, except the Snippet PrintChunk works! How to deduce from the snippet? The documentation shows, as if I am writing everything correctly, although in reality this is not working ... I don’t even know what to do. Watched examples here: link .

Update

I rewrote the snippet and call of the chunk via pdoTools, and still does not work as it should. I give the code:

 $pdo = $modx->getService('pdoTools'); $tpl = $modx->getOption($chank, $scriptProperties, '@INLINE array(\'id\'=>\'[[+id]]\'); '); $return=''; $return .= $pdo->getChunk($tpl, array('id'=>'1')); return $return; 

I call in the same way:

 [[!PrintChunk? &chank=`tell_my`]] 

The output is not getting the contents of the chunk (and there is a form), but the output of the array, which is indicated in the snippet, that is, the following:

 array('id'=>'1'); 

What could be the problem? Who will tell?

    1 answer 1

    The solution was found). Here, maybe someone will come in handy:

     $pdo = $modx->getService('pdoTools'); return $pdo->getChunk($chank, array('id'=>'1')); 

    And then call this snippet:

     [[!PrintChunk? &chank=`tell_my`]] 

    True, there is not used INLINE binding.

    PS This question is also why I can’t mark the right answer to myself? This is a question for site administrators or moderators.