-
☆ A M B ☆
- 265 Posts
Up until recently I’d been using getResources to pretty much duplicate all the functionality of Evo’s Ditto, which was fine until I needed some pagination; then I found
this tutorial which introduced me to the getResourcesTag snippet to generate the pagination links.
In order to install the getResourcesTag snippet I had to install the tagLister snippet, since the getResourcesTag snippet isn’t available to install as a standalone snippet - this slightly confused me as I thought I was installing getResourcesTag to generate pagination, why would I need tagLister installed? - Is there a way to generate pagination links using just getResources?
Also, what is the getPage snippet for; is this something I should always install and regularly use in my workflow?
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
for pagination you would use getPage.
Its a wrapper-snippet which generates pagination-links and handles the pagination itself.
You can use it together with all snippets which generate a total-placeholder and have the properties &limit and &offset
examples how to use it together with getResources are here:
http://rtfm.modx.com/display/ADDON/getPage
-
☆ A M B ☆
- 265 Posts
Thanks for the info!
So what exactly is a wrapper-snippet?
I’ve started to feel very comfortable using getResources and having to use getResourcesTags had kinda thrown me off a bit - are you saying there’s a way to wrap getPages in a way so I can stick with using getResources and still get pagination?
MODX Ambassador for Thailand. Managing Director at
Monogon, a web design and development studio based in Bangkok, Thailand. -
Follow me on Twitter.
you use getPage the same way you did use getResources with additional parameters for getPage.
getPage calls getResources when you add this parameter to your getPage-tag:
&element=`getResources`
A wrapper snippet wraps another snippet call with some extra parameters that aren’t currently in the child snippet functions - or have functionality that could equally apply across a variety of snippets.
The Executioner snippet, for example, wraps around any snippet to tell you how long that snippet took to execute. getPage and taglister are more explicitly tied in to getResources, but could in theory be used on any resource listing snippet.
It also returns control to the wrapper snippet, for further processing.
Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86