I am running Modx Revo 2.2.8pl and 2.2.10pl with getResources 1.6.1pl on 1and1 hosting.
I am having a hard time getting resources info displayed.
I created 2 pages under Home, i.e. Home 2 and Home 3.
Using this code:
[[getResources:default=`No results found`? &parents=`[[*id]]` &showHidden=`1` &tpl=`@INLINE <li title="[[+longtitle]]">page - [[+pagetitle]]</li>`]]
I get:
page - Home 2
page - Home 3
Using this code:
[[getResources:default=`No results found`? &parents=`[[*id]]` &showHidden=`1` &tpl=`pageIndex`]]
pageIndex contains <li title="[[+longtitle]]">page - [[+pagetitle]]</li>
I get:
No results found
I expected the same as above.
SOLVED: pageIndex needs to be a chunk and not a template, even though the parm is tpl.
Using this code:
[[getResources:default=`No results found`? &parents=`[[*id]]` &showHidden=`1`]]
I get:
No results found.
I expected a list of properties.
Clearly I am doing something incorrectly does anyone have an idea as to what is wrong?
Looking at the changelog for getResources 1.6.1pl :
Only dump properties for invalid tpl when debug enabled
Well that sucks! The one thing I figured would be really useful in learning/developing has been removed, so none of the documentation/examples cannot be trusted.
I will continue with the previous version for this first project and switch to pdoResources for the next.
[ed. note: davidryman last edited this post 11 years ago.]
-
☆ A M B ☆
- 24,524 Posts
That's why it's called a tpl, and not a template. It is technically a template for the snippet's output, but calling them "templates" was too confusing.
As far as not getting the array of properties if no tpl is specified, I suspect that the 'default' option is overriding everything other than a valid output.
Have you tried this?
[[!getResources? &parents=`[[~[[*id]]` &showhidden=`1` &debug=`1` &tpl=`xxx`]]
-
☆ A M B ☆
- 24,524 Posts
is a problem. The parents property takes a resource ID. The [[~...]] tag will generate a URL from a given resource ID. What you have there is a partial URL tag for making a URL out of the current resource's ID. The proper tag for such a thing would be
But I presume that is not what you meant.
-
☆ A M B ☆
- 24,524 Posts
Chunks are any HTML code, including text, HTML tags, other MODX tags, and javascript. They used to be call "htmlsnippets", and in fact that is still the name of their table in the database.
Snippets are PHP code.
Templates are the site templates that format your entire page; they are managed in the "Templates" section of the Elements tab.
"tpls" are the mini-templates used by snippet to format the snippet output. They're specifically called "tpls" to differentiate them from the main site templates. They can be chunks, but sometimes the snippet allows files, inline tpl definitions, and some even allow resource content. But in all cases, they are applied only to the snippet's output, in the case of listing snippets like getResources or Wayfinder, the same tpl is applied to each item the snippet is processing.
getResources should return an array containing a bunch of values for each item it finds if no tpl is specified.