0

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

MeltingDog
  • 14,310
  • 43
  • 165
  • 295

2 Answers2

5

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.

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
  • Ah thanks! So I must use a template even if I just want the content and nothing else? – MeltingDog Sep 04 '12 at 01:49
  • Yes, generally speaking getResources is used to grab a group of resources and needs to loop over them for output. If you have just a single field to retrieve, try using getResourcefield .... [also omitting the &tpl in getResources is useful for debugging ;)] – Sean Kimball Sep 04 '12 at 13:26
0

Actually there is no need to use a template. This code is working fine:

[[getResources? &resources=1 &tpl=@INLINE [[+content]] &includeContent=1 ]]

GMchris
  • 5,439
  • 4
  • 22
  • 40
frony
  • 1