Simplify the parsing of paging code on the php template page _ php skills

Source: Internet
Author: User
Tags php template
This article focuses on "using templates", but this method is suitable for any scenario and is a good solution when using templates, this problem occurs: the operation is troublesome when the paging information is displayed. n templates have paging blocks.
For example:
--- A total of 20 records. GO -----
When I first encountered this problem, it seemed that I was playing the php idea to solve it. how can I use php to implement it, however, no matter how you design it, design it into two solutions.
1. implement with nested loops
2. using n multiple judgments
But in the end, it is quite troublesome, and the server-side resources are used for parsing.
Use javascript to replace your php !!!!, In this way, you can reduce the amount of php script code and hand over the paging parsing work to the client. However, javascript debugging may be troublesome.
The most important thing is to simplify the difficulties encountered by parsing templates during paging display.
The following is a template that supports parsing by pear itx template tool.
Where And Indicates a block. a string similar to {recordcount} is a variable.
---------------- List. tpl ---------------------

The code is as follows:


// Other html code




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.