dwoo-project / dwoo

[UNMAINTAINED] php template engine
http://dwoo.org
GNU Lesser General Public License v3.0
167 stars 58 forks source link

Paginate Plugin for dwoo2 #9

Open MikeW22 opened 10 years ago

MikeW22 commented 10 years ago

I use dwoo for many projects. Now, I'm lookin for a paginate Plugin.

emulienfou commented 10 years ago

Is it what you want ? http://www.phpinsider.com/php/code/SmartyPaginate/

MikeW22 commented 10 years ago

Right !

Best Regards

Michael Woldrich

Von: DSanchez [mailto:notifications@github.com] 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

themightychris commented 10 years ago

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}">&larr;&nbsp;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&nbsp;&rarr;</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}
emulienfou commented 10 years ago

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}.

emulienfou commented 7 years ago

Need to check this code in 1.2.2 and provide a demo for future use!