dwoo
dwoo copied to clipboard
Paginate Plugin for dwoo2
I use dwoo for many projects. Now, I'm lookin for a paginate Plugin.
Is it what you want ? http://www.phpinsider.com/php/code/SmartyPaginate/
Right !
Best Regards
Michael Woldrich
Von: DSanchez [mailto:[email protected]] Gesendet: Montag, 3. Februar 2014 07:51 An: emulienfou/dwoo Cc: MikeW22 Betreff: Re: [dwoo] Paginate Plugin for dwoo2 (#9)
Is it what you want ? http://www.phpinsider.com/php/code/SmartyPaginate/
— Reply to this email directly or view it on GitHub https://github.com/emulienfou/dwoo/issues/9#issuecomment-33928147 . https://github.com/notifications/beacon/6555811__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwNjk0MzA0NSwiZGF0YSI6eyJpZCI6MjQ2OTY3MDB9fQ==--dec6c89403f864a5a9a9ff4f308ffc8637b38cd6.gif
Maybe this template I use would be helpful to you:
{template pagingLinks total pageSize=12 showAll=false}
<div class="paging">
{if $total > $pageSize}
{$previousOffset = tif($.get.offset && $.get.offset > $pageSize ? $.get.offset - $pageSize : 0)}
{$nextOffset = tif($.get.offset ? $.get.offset + $pageSize : $pageSize)}
{if $.get.offset > 0}
<a class="paging-link prev" href="?{refill_query limit=$pageSize offset=$previousOffset}">← Prev</a>
{/if}
<ol class="paging-pages">
{foreach item=page from=range(1,ceil($total/$pageSize))}
{math "($page-1)*$pageSize" assign=offset}
<li class="paging-page">
{if $.get.offset == $offset}
<strong class="paging-current">{$page}</strong>
{else}
<a class="paging-link" href="?{refill_query limit=$pageSize offset=$offset}">{$page}</a>
{/if}
</li>
{/foreach}
</ol>
{if $.get.offset < $total - $pageSize}
<a class="paging-link next" href="?{refill_query limit=$pageSize offset=$nextOffset}">Next →</a>
{/if}
{if $showAll}
<a class="paging-link show-all" href="?{refill_query limit=0}">Show All ({$total|number_format})</a>
{/if}
{/if}
</div>
{/template}
For information, the Block template
as been replaced by function
in Dwoo 2.
So, in Dwoo 2.x branch you need to replace {template}{/template}
by {function}{/function}
.
Need to check this code in 1.2.2 and provide a demo for future use!