We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22165
    • 5 Posts
    Hi,

    I’ve been trying to use getResources to list data and parse them through a template, but it keeps outputting the data without parsing through a template.

    Here’s my call to getResources

    [[!getResources? &parent='5' &showHidden='1' &includeContent='1' &tpl='people']]
    


    My template looks like this

    <section class="highlight">
    	<h3>[[+pagetitle]]</h3>
    	<p>[[+content]]</p>
    </section>
    


    Any ideas? I’m using modx 2.0.7 with getResources 1.2.2-pl.
      • 4172
      • 5,888 Posts
      Use backticks:

      [[!getResources? &parent=`5` &showHidden=`1` &includeContent=`1` &tpl=`people`]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22165
        • 5 Posts
        Hm, thanks. But I still get the same output. A long list of stringified Arrays.

        Array
        (
            [tpl] => summary
            [tplOdd] => 
            [tplFirst] => 
            [tplLast] => 
            [sortby] => publishedon
            [sortbyTV] => 
            [sortbyAlias] => 
            [sortbyEscaped] => 0
            [sortdir] => DESC
            [sortdirTV] => DESC
            [limit] => 5
            [offset] => 0
            [tvFilters] => 
            [depth] => 10
            [parents] => 
            [includeContent] => 1
            [includeTVs] => 
            [showHidden] => 1
            [showUnpublished] => 
            [showDeleted] => 
            [resources] => 
            [processTVs] => 
            [tvPrefix] => tv.
            [idx] => 1
            [first] => 1
            [last] => 3
            [toPlaceholder] => 
            [debug] => 
            [parent] => 4
            [id] => 10
            [type] => document
            [contentType] => text/html
            [pagetitle] => Peter
            [longtitle] => Peter Nederlof
            [description] => Peter Nederlof
            [alias] => 
            [link_attributes] => 
            [published] => 1
            [pub_date] => 0
            [unpub_date] => 0
            [isfolder] => 
            [introtext] => 
            [content] => 
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        
            [richtext] => 1
            [template] => 3
            [menuindex] => 0
            [searchable] => 1
            [cacheable] => 
            [createdby] => 1
            [createdon] => 2011-01-25 12:01:07
            [editedby] => 1
            [editedon] => 2011-01-25 12:21:21
            [deleted] => 
            [deletedon] => 0
            [deletedby] => 0
            [publishedon] => 2011-01-25 12:01:00
            [publishedby] => 1
            [menutitle] => Peter
            [donthit] => 
            [haskeywords] => 
            [hasmetatags] => 
            [privateweb] => 
            [privatemgr] => 
            [content_dispo] => 0
            [hidemenu] => 1
            [class_key] => modDocument
            [context_key] => web
            [content_type] => 1
        )
        Array
        (
            [tpl] => summary
            [tplOdd] => 
            [tplFirst] => 
            [tplLast] => 
            [sortby] => publishedon
            [sortbyTV] => 
            [sortbyAlias] => 
            [sortbyEscaped] => 0
            [sortdir] => DESC
            [sortdirTV] => DESC
            [limit] => 5
            [offset] => 0
            [tvFilters] => 
            [depth] => 10
            [parents] => 
            [includeContent] => 1
            [includeTVs] => 
            [showHidden] => 1
            [showUnpublished] => 
            [showDeleted] => 
            [resources] => 
            [processTVs] => 
            [tvPrefix] => tv.
            [idx] => 2
            [first] => 1
            [last] => 3
            [toPlaceholder] => 
            [debug] => 
            [parent] => 4
            [id] => 9
            [type] => document
            [contentType] => text/html
            [pagetitle] => Arjen
            [longtitle] => Arjen Geerse
            [description] => Arjen Geerse
            [alias] => 
            [link_attributes] => 
            [published] => 1
            [pub_date] => 0
            [unpub_date] => 0
            [isfolder] => 
            [introtext] => 
            [content] => 				Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
            [richtext] => 1
            [template] => 3
            [menuindex] => 0
            [searchable] => 1
            [cacheable] => 
            [createdby] => 1
            [createdon] => 2011-01-25 12:00:12
            [editedby] => 1
            [editedon] => 2011-01-25 12:21:04
            [deleted] => 
            [deletedon] => 0
            [deletedby] => 0
            [publishedon] => 2011-01-25 12:00:00
            [publishedby] => 1
            [menutitle] => Arjen
            [donthit] => 
            [haskeywords] => 
            [hasmetatags] => 
            [privateweb] => 
            [privatemgr] => 
            [content_dispo] => 0
            [hidemenu] => 1
            [class_key] => modDocument
            [context_key] => web
            [content_type] => 1
        )
        Array
        (
            [tpl] => summary
            [tplOdd] => 
            [tplFirst] => 
            [tplLast] => 
            [sortby] => publishedon
            [sortbyTV] => 
            [sortbyAlias] => 
            [sortbyEscaped] => 0
            [sortdir] => DESC
            [sortdirTV] => DESC
            [limit] => 5
            [offset] => 0
            [tvFilters] => 
            [depth] => 10
            [parents] => 
            [includeContent] => 1
            [includeTVs] => 
            [showHidden] => 1
            [showUnpublished] => 
            [showDeleted] => 
            [resources] => 
            [processTVs] => 
            [tvPrefix] => tv.
            [idx] => 3
            [first] => 1
            [last] => 3
            [toPlaceholder] => 
            [debug] => 
            [parent] => 4
            [id] => 8
            [type] => document
            [contentType] => text/html
            [pagetitle] => Olivier
            [longtitle] => Olivier Hermanus
            [description] => Olivier Hermanus
            [alias] => 
            [link_attributes] => 
            [published] => 1
            [pub_date] => 0
            [unpub_date] => 0
            [isfolder] => 
            [introtext] => 
            [content] => 
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        
            [richtext] => 1
            [template] => 3
            [menuindex] => 0
            [searchable] => 1
            [cacheable] => 
            [createdby] => 1
            [createdon] => 2011-01-25 11:56:15
            [editedby] => 1
            [editedon] => 2011-01-25 12:21:11
            [deleted] => 
            [deletedon] => 0
            [deletedby] => 0
            [publishedon] => 2011-01-25 11:56:00
            [publishedby] => 1
            [menutitle] => Olivier
            [donthit] => 
            [haskeywords] => 
            [hasmetatags] => 
            [privateweb] => 
            [privatemgr] => 
            [content_dispo] => 0
            [hidemenu] => 1
            [class_key] => modDocument
            [context_key] => web
            [content_type] => 1
        )
        

          • 22165
          • 5 Posts
          Oh, wait... You’re right... My bad. smiley

          Renamed the template to try some different stuff. Seems to work now. Thanks!
            • 22165
            • 5 Posts
            Right... I’m starting to feel like an idiot now.

            I get the data and parses into a chunk. It iterates over all items in the getResources result, but it renders the data from the last (top) item in the results. It renders the template with the same data as many times as there are individual items in the result.

            What am I doing wrong here? Do I need to specify some template variables?

            Regards,
            O.