Created
September 9, 2011 16:42
-
-
Save croxton/1206694 to your computer and use it in GitHub Desktop.
Stash with Channel module: handling no results
This file contains 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" | |
} | |
<tr> | |
<td>{title}</td> | |
</tr> | |
{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 alt"> | |
<p class="results-summary">No results</p> | |
</div> | |
{if:else} | |
<div class="results-header"> | |
{exp:stash:get name='pagination_links'} | |
</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"> | |
{exp:stash:get name='pagination_summary'} | |
{exp:stash:get name='pagination_links' random} | |
</div> | |
{/if} | |
</div> | |
<!-- /Results --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment