ModX Revo: Display one resource within another
-
30-06-2021 - |
Question
I want to display the contents of one resource within another. I think this is possible with getResources but I cannot get it working for me. I have:
[[getResources &parents=`-1` $resources =`16`]]
but nothing displays. I have made sure all resources have been published and that getResources is installed correctly.
Can anyone point me in the right direction?
Thanks
Solution
Yes - that's exactly what getResources is for, you are not getting anything because you have a few syntax errors.
[[getResources &parents=-1
$resources =16
]]
should be:
[[getResources? &parents=-1
&resources =16
&tpl=myTpl
]]
the '?' tells Modx that there will be parameters, $resources will get ignored & if you don't specify an &tpl parameter, getResources will just dump the raw array to your page.
OTHER TIPS
Actually there is no need to use a template. This code is working fine:
[[getResources? &resources=1 &tpl=@INLINE [[+content]] &includeContent=1 ]]