Hello-
I'm using getResources/getPage to create galleries. I have 3 galleries broken into 3 separate categories. I'm currently using pagination to display 9 items per page. My client would like me to add functionality that allows end-users to view all items within each category on one page. I.e. I want something where pagination shows '1 of 6 Prev Next View All'. I'm unsure of the best way to implement such a feature. Any help or insight would be greatly appreciated.
Site is running Revo 2.2.4 on Media Temple grid server.
thanks.
-
☆ A M B ☆
- 2,213 Posts
You could switch to getResources with a limit high enough to show all of the pages, and/or increase the limit for getPage. The trick is knowing the total resource count and then in some way passing that value back to the snippet call (perhaps using getUrlParam?).
So doing something like:
[[!getPage? &element=`getResources` &parents=`[[*id]]` &limit=`[[!getUrlParam? &name=`all` &int=`1`]]` &tpl=`myRowTpl`]]
<div class="pageNav">[[!+page.nav]]</div> <a href="[[*id? &all=`[[+total]]`]]">View All</a>
There is likely a cleaner way, but this is just off the top of my head.
-
MODX Staff
- 10,725 Posts
This is ok if you cache everything and do not edit frequently, but in general it is a bad idea to use a limit over a reasonable number, especially if each Resource is generating thumbnails, or processing TV's. For each result, you are going to increase the load time exponentially, so you need to consider this and set reasonable limits to avoid creating potential performance bottlenecks in your site. Again, what is a reasonable number depends on how long each Resource is taking to process when not cached; I generally never use anything over 25 or 50 unless it is a call that uses no TV's and has limited processing demands in the tpls being used.