Created
April 16, 2012 09:53
-
-
Save croxton/2397394 to your computer and use it in GitHub Desktop.
Stash paginated results listing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {!-- build result rows --} | |
| {exp:stash:set parse_tags="yes"} | |
| {stash:results_rows} | |
| {exp:channel:entries | |
| channel="my_channel" | |
| limit="10" | |
| paginate="bottom" | |
| dynamic="no" | |
| } | |
| <tr> | |
| <td>{title}</td> | |
| </tr> | |
| {stash:results_from}{absolute_count}{/stash:results_from} | |
| {stash:total_results}{total_results}{/stash:total_results} | |
| {stash:absolute_results}{absolute_results}{/stash:absolute_results} | |
| {paginate} | |
| {stash:pagination_summary}Page {current_page} of {total_pages}{/stash:pagination_summary} | |
| {stash:pagination_links}{pagination_links}{/stash:pagination_links} | |
| {/paginate} | |
| {/exp:channel:entries} | |
| {/stash:results_rows} | |
| {/exp:stash:set} | |
| <!-- Results --> | |
| <div class="data"> | |
| {if "{exp:stash:get name='absolute_results'}" == "0"} | |
| <div class="results-header"> | |
| <p class="results-summary">No results</p> | |
| </div> | |
| {if:else} | |
| <div class="results-header"> | |
| <p class="results-summary"> | |
| {exp:stash:get name='results_from'} | |
| - | |
| {exp:mx_calc expression='{exp:stash:get name="results_from"} + {exp:stash:get name="total_results"} - 1' parse="inward"} | |
| of | |
| {exp:stash:get name='absolute_results'} result{if "{exp:stash:get name='absolute_results'}" > 1}s{/if} | |
| </p> | |
| <p class="paging-r">{exp:stash:get name='pagination_links'}</p> | |
| </div> | |
| <table summary="results listing"> | |
| <thead> | |
| <tr> | |
| <th>Title</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {exp:stash:get name="results_rows"} | |
| </tbody> | |
| </table> | |
| <div class="results-footer"> | |
| <p class="paging-l"> | |
| {exp:stash:get name='pagination_summary'} | |
| </p> | |
| <p class="paging-r"> | |
| {exp:stash:get name='pagination_links' random} | |
| </p> | |
| </div> | |
| {/if} | |
| </div> | |
| <!-- /Results --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment