We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21395
    • 91 Posts
    I've been using getResources, tagLister et al quite successfully for a real estate listings website. Individual properties are manually tagged, and getResourcesTag filters very nicely on click-able tags.

    I then decided to paginate the results and this is the call I wanted to use.

    [[!getResourcesTag?
           &elementClass=`modSnippet`
           &element=`getResources`
           &tpl=`propertySummaryTpl_en`
           &parents=`2`
           &limit=`0`
           &sortbyTV=`price`
           &sortdirTV=`ASC`
           &sortbyTVType=`decimal`
           &includeTVs=`1`
           &tagKey=`tags`
           &showHidden=`0`
           &hideContainers=`1`
    	&pageVarKey=`page`
    ]]
    	[[!+page.nav:notempty=`
    	<div class="paging"> 
    	<ul class="pageList">
    	[[!+page.nav]] 
    	</ul> 
    	</div>
    	`]]
    


    Basically the same call I'd been using, but with &pageVarKey added, and a pagination call added afterwards.

    But it wouldn't paginate. So I thought - not surprising - it's getPage that uses &pageVarKey. So I built a getPage call that gave &element=`getResourcesTag`, and got an out of memory error:

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2448 bytes) in /home/aquit913/public_html/core/xpdo/om/xpdoobject.class.php on line 881
    


    Here's the offending getPage call:

    [[!getPage? 
    	&elementClass=`modSnippet` 
    	&element=`getResourcesTag` 
    	&parents=`2`
    	&pageVarKey=`page` 
    	&includeTVs=`1`
    	&processTVs=`1`
    	&sortbyTV=`price`
    	&sortdirTV=`ASC`
    	&sortbyTVType=`decimal`
            &tagKey=`tags`
    	&tpl=`propertySummaryTpl_en`
    ]]
    <div class="paging">
    	<ul class="pageList">
    		[[!+page.nav]]
    	</ul>
    </div>
    


    I believe that both getPage and getResourcesTag are "wrapper" snippets, and there is doubtless something offensive about wrapping a wrapper within another wrapper [sorry], but I finally got it to work.I removed the &limit=`0` parameter from the original call (originally inserted to make it find more than 5 items before I thought of pagination).

    It seems to me that &limit isn't working in getResourcesTag as it does in getResources.

    Other users might want totake note.
      MODX Revolution 2.6.5-pl (traditional)

      Hosted on MODX Cloud

      Skype: nicbaldeagle