Problem with embedding collections in themes

Hi, I’m new to modx and don’t know PHP. Still, I want to try my hand at modx, but I don’t know if I miscalculated. At the beginning I have a problem with the Collection module. From the backend side, I somehow managed a simple configuration of the module.

However, I am unable to display the data in themes for the visitor. All the manuals tell how to organize the backend, and I can’t find how to release this data. I guess the habits from another cms obscure the picture for me. Can someone explain to me in simple steps with a basic example how to do it?

I need information:

  1. What else to install besides: Collections, getResources?
  2. What to put in: Templates?
  3. What to put in: Snippet?
  4. Do you need anything besides the above?
    These are the minimum settings (examples), for: Content, Title, TV picture. I want to list children items with fields like this.

Maybe if you can go through it and understand the assumptions, it will be easier to continue. Sorry for the probably stupid questions.

The extra Collections just display the data differently in the MODX manager. But the pages you create in Collections containers are still normal MODX resources and you can output them like any other resources in a normal folder.

Yes, getResources is one option. Or you could install the extra pdoTools that contains the snippet pdoResources (which is similar to getResources).

In the template (or the content of a resource) put a snippet tag to call getResources:
For example:

[[getResources?
    &parents=`3`
    &tpl=`@INLINE <li>[[+pagetitle]]</li>`
    &limit=`0`
]]

Set the property &parents to the ID of your Collections container.

To include the content, set the property &includeContent to 1.
To include TVs, use &includeTVs=`1`
Set the property &tpl to the name of a chunk (e.g. “tplPage”).

[[getResources?
    &parents=`3`
    &tpl=`tplPage`
    &includeTVs=`1`
    &includeContent=`1`
    &limit=`0`
]]

In the chunk tplPage use placeholders for the fields. The TV fields have a prefix tv.:

<h2>[[+pagetitle]]</h2>
<p>[[+content]]</p>
<img src="[[+tv.myImageTemplateVar]]">
1 Like