Smarty simple Pagination Implementation Method _php example

Source: Internet
Author: User
The example of this paper describes the implementation of Smarty simple paging, shared for everyone to reference. The implementation method is as follows:

The following is the template of the Smarty code, with Smarty simple to enter the relevant variables on the line, very simple, but also in the PHP code to pass the page this parameter. I think this is very good, very simple. I'm more and more fond of using smarty.

The PHP code is as follows:
Copy the Code Code as follows: {if $pageCount > 1}
{foreach item=i from= $pagerList}
{if $pageNum eq $i}
{$i}
{Else}
{$i}
{/if}
{/foreach}
{if $pageNum eq 1}
Previous page
{Else}
Previous page
{/if}
{if $pageNum eq $pageCount}
Next page
{Else}
Next page
{/if}
{if $pageNum eq 1}
Home
{Else}
Home
{/if}

{if $pageNum eq $pageCount}
Last page
{Else}
Last page
{/if}
{/if}
(Total {$pageCount} page)

Here just give a thought, actually the pagination is not so complicated.

I hope this article is helpful to everyone's PHP programming.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.