MODX 2.8.4 getResources toPlaceholder Problem


I have a template with the following geResources call:

                &resources=`[[!getQueryStringValue? &field=`id`]]` 

In Debug the sql delivers the expected data.
I decided not to use &tpl and use toPlaceholder.

But why I don’t have data when I use [[+p.content]] etc.?

What do I have made wrong?

Isn’t it possible to access output placeholder. Only whole $output?

Thank you in advance.


The property &toPlaceholder is not a replacement for &tpl.
It just means, that the same output from the getResources snippet is stored in a placeholder, instead of being returned and inserted at the position of the snippet call.

What exactly are you trying to do?

If you only need one field from the resource, you could maybe use the extra getResourceField or fastField instead.

The fastField syntax is also included in the extra pdoTools, and with pdoResources you can return the data as JSON, to get direct access to a specific resource field.

thank you very much.

May be I have a misunderstanding.

so I use &tpl insteed and all is good.

thank you very much.

If you’re writing your own snippet, $modx->toPlaceholder() and $modx->toPlaceholders() take a prefix as an optional second argument. Some snippets use them, but as halftrainedharry says, getResources sets the whole output of the snippet as a placeholder with no prefix.