-
Notifications
You must be signed in to change notification settings - Fork 20
Capturing pagination
Mark Croxton edited this page Jun 21, 2013
·
3 revisions
Capture your entries and pagination data like this:
{exp:channel:entries}
{exp:stash:append_list name="my_entries"}
{stash:title}{title}{/stash:title}
{stash:url_title}{url_title}{/stash:url_title}
{/exp:stash:append_list}
{paginate}
{exp:stash:set_list name="pagination"}
{stash:current_page}{current_page}{/stash:current_page}
{stash:total_pages}{total_pages}{/stash:total_pages}
{pagination_links}
{first_page}{stash:first_page}{pagination_url}{/stash:first_page}{/first_page}
{previous_page}{stash:previous_page}{pagination_url}{/stash:previous_page}{/previous_page}
{next_page}{stash:next_page}{pagination_url}{/stash:next_page}{/next_page}
{last_page}{stash:last_page}{pagination_url}{/stash:last_page}{/last_page}
{/pagination_links}
{/exp:stash:set_list}
{/paginate}
{/exp:channel:entries}
Use it like this:
<ul>
{exp:stash:get_list name="my_entries"}
<li>
<a href="{url_title}">{title}</a>
</li>
{/exp:stash:get_list}
</ul>
{exp:stash:get_list name="pagination" limit="1"}
<ul class="pagination pagination--footer">
<li class="pagination-page">Page {current_page} of {total_pages}</li>
{if previous_page}<li class="pagination-prev"><a href="{previous_page}">Prev</a></li>{/if}
{if next_page}<li class="pagination-next"><a href="{next_page}">Next</a></li>{/if}
</ul>
{/exp:stash:get_list}
Getting started
Using Stash
Using Mustash
- Mustash
- Installing Mustash
- Managing variables
- Managing bundles
- Cache-breaking rules
- Mustash plugins
- Mustash Varnish plugin
- Mustash plugin development
- Mustash API
Template design patterns
Tag reference
- {exp:stash:set}
- {exp:stash:get}
- {exp:stash:block}
- {exp:stash:set_value}
- {exp:stash:append}
- {exp:stash:append_value}
- {exp:stash:prepend}
- {exp:stash:prepend_value}
- {exp:stash:copy}
- {exp:stash:context}
- {exp:stash:is_empty}
- {exp:stash:not_empty}
- {exp:stash:set_list}
- {exp:stash:get_list}
- {exp:stash:append_list}
- {exp:stash:prepend_list}
- {exp:stash:split_list}
- {exp:stash:join_lists}
- {exp:stash:list_count}
- {exp:stash:unset}
- {exp:stash:flush_cache}
- {exp:stash:bundle}
- {stash:embed}
- {exp:stash:extend}
- {exp:stash:parse}
- {exp:stash:cache}
- {exp:stash:static}
- {exp:stash:finish}
- {exp:stash:not_found}
- Short tag syntax
- Using Stash methods in your own add-ons