Processing of pagination of templates in PHP, reading the processing of pagination of templates in PHP, it is relatively simple to process pagination when PHP code and html code are mixed in common php development, it can also be constructed as a function. Recently, the Pear: DB + Smarty structure is used in development. Therefore, if the template is paginated and the page cannot be operated directly, you need to generate the score "> <LINKhref =" http: //
When PHP code and html code are mixed in normal php development, it is relatively simple to process pages. you can also build them into functions. Recently, the Pear: DB + Smarty structure is used in development. Therefore, if you want to paging the template, you should consider generating a paging string because you cannot directly operate the page.
Because it is a three-tier structure, the class library --> PHP call --> template form, all the data processing is in the class library, so paging control is carried out in the PHP call, the template parses the call results in a complex way. Let's look at the paging code in PHP calls:
--------------------------------------------------------------------------------
/**
* File: Type. php
* Function: displays books under a category.
* Author: heiyeluren
**/
// Contains public files, including class libraries
Require_once ("include. php ");
// Instantiate the operation object
$ Type = new CTypes ();
// Number of records per page
Define ("PAGE_SIZE", 10 );
// GET the variable submitted by GET
$ TypeID = $ tid? $ Tid: intval ($ _ REQUEST ['tid']);
// Total number of books
$ BookTotal = $ Type-> getBookTotal ($ TypeID );
/* Display the core by page */
// Obtain the total number of pages
$ PageCount = ($ BookTotal/PAGE_SIZE );
// Current page number
If (isset ($ _ GET