We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46630
    • 40 Posts
    I would like to add pages to resources with depth of 3. So I have getResources chunk - events_list:

    <div>
     [[getResources?  
            &parents=`13`
    		&where=`{"template:=":4}`
             &tpl=`events_list_tpl` 
            &includeTVs=`1`
    		&processTVs=`1`
    		&tvFilters=`event-date<<[[curentDate]]`
            &includeContent=`1`
    		&depth=`3`
    		&limit=`0`
    	]]  
    </div>
    


    Also I have created the following tpl - events_list_tpl:

    <div class="sixteen columns event_list">
    	<div style="float:left; margin-right:10px; width:80px"><img class="responsive_image" src="[[+tv.event_image:phpthumbof=`w=300`]]" /></div>
    	<div>
    		<h5><a href="[[~[[+id]]]]">[[+longtitle]]</a></h5>
    		<h6>[[+tv.event-date:strtotime:date=`%d.%m.%Y`]] - [[getResourceField? &id=`[[+tv.event_place]]` &field=`pagetitle` &default=`Sorry, no data available`]]</h6>
    	</div>
    	<hr>
    </div>
    


    But non of this works in getPage. The page shows all resources and there is no pagination. Here is my getPage code:

    [[!getPage? &elementClass=`modChunk` &element=`events_list` &tpl=`events_list_tpl`]]
    <div class="pageNav">[[!+page.nav]]</div>
    


    Could someone help me with that. I would like to display 5 events on every page. Thanks in advance.

    This question has been answered by fractalwolfe. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I am pretty sure you need to use getPage as a wrapper for getResources, not for the chunk.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 46630
        • 40 Posts
        Quote from: sottwell at Aug 09, 2014, 10:43 AM
        I am pretty sure you need to use getPage as a wrapper for getResources, not for the chunk.

        I am not sure that I understand correctly. I've already tried:

        [[!getPage? &elementClass=`modSnippet` &element=`getResources` &tpl=`events_list_tpl` &parents=`13`]]
        <div class="pageNav">[[!+page.nav]]</div>


        Thats displayed all the children of resource 13 but with no depth. It ruined my design and aslo some elements were missing.

        Could you help me with some code?
        • discuss.answer
          • 43302
          • 18 Posts
          Quote from: ispasov at Aug 09, 2014, 10:59 AM
          Quote from: sottwell at Aug 09, 2014, 10:43 AM
          I am pretty sure you need to use getPage as a wrapper for getResources, not for the chunk.

          I am not sure that I understand correctly. I've already tried:

          [[!getPage? &elementClass=`modSnippet` &element=`getResources` &tpl=`events_list_tpl` &parents=`13`]]
          <div class="pageNav">[[!+page.nav]]</div>

          The getPage snippet acts as a wrapper for getResources, and any properties that do not belong to getPage will get passed along for getResources to process.

          As such, you can do this to achieve what you want:
          [[!getPage?
            &elementClass=`modSnippet`
            &element=`getResources` 
            &tpl=`events_list_tpl` 
            &parents=`13`
            &where=`{"template:=":4}`
            &includeTVs=`1`
            &processTVs=`1`
            &tvFilters=`event-date<<[[curentDate]]`
            &includeContent=`1`
            &depth=`3`
            &limit=`10`
          ]]
          <div class="pageNav">[[!+page.nav]]</div>

          The limit property tells getPage how many items you want per page.
            • 46630
            • 40 Posts
            Thank you, fractalwolfe and sottwell. That was awesome! Finally I get it.