Implementation of smarty simple paging _ php instance

Source: Internet
Author: User
This article mainly introduces the implementation of smarty simple paging, and describes the complete implementation process of smarty paging with a specific instance, for more information about how to implement smarty simple paging, see the examples in this article. The specific implementation method is as follows:

The following is the smarty code in the template. You can simply use smarty to replace the relevant variables. It is very simple, but you need to input the page parameter in the php code. I think this is quite simple. I like smarty more and more.

The Php code is as follows:

The Code is 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}
Homepage
{Else}
Homepage
{/If}

{If $ pageNum eq $ pageCount}
Last page
{Else}
Last page
{/If}
{/If}
({$ PageCount} pages in total)

Here is just an idea. In fact, paging is not that complicated.

I hope this article will help you with PHP programming.

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.