phpcms V9 custom paging function

We do the site, it may often pagination style had to be controlled according to the requirements template, then many people will go to modify the global file phpcms \ libs \ functions \ global.func.php inside pages () function, so the problem We came: the paging function will affect even the background, that is, the paging function is common to the entire station.
Provide solutions to the following :( this was modified file, remember to back up before the amendment)
open
phpcms \ libs \ functions \ global.func.php this file, locate the paging function, copy it, paste the following default paging function, rename, such as I just named wz_pages, save.

Open
phpcms / libs / classes / template_cache.class.php, find the line 207
$ str = '$ pages = pages ($' $ op .'_ total, $ page, $ pagesize, $ urlrule.);. ';
In this bottom row plus
$ str = '$ wz_pages = wz_pages ($' $ op .'_ total, $ page, $ pagesize, $ urlrule.);. ';
save.

Finally, if you want to use your custom paging function, then used directly in the template {$ wz_pages} on it, and,

in the future to modify the style, directly modify
phpcms \ libs \ functions \ global.func.








Open
phpcms / libs / classes / template_cache.class.php, find the line 178
$ str = '$ r = $ get_db-> sql_query ( "' $ sql '..");. $ S = $ get_db-> fetch_next ( ); $ pages = pages ($ s [\ 'count \'], $ page, $ pagesize, $ urlrule); ';
increase in he following:
$ = STR.' $ $ = R & lt get_db-> sql_query ( " ' . $ sql. ' "); $ s = $ get_db-> fetch_next (); $ wz_pages = wz_pages ($ s [\' count \ '], $ page, $ pagesize, $ urlrule);';

this, SQL is paging is also normal, and, hey, welcome Paizhuan, do not shoot, you have to Dinga ~~

subsequent optimization again:

a friend mentioned that Member Center page list of favorites can not use the above approach.
Because the paging function directly in the favorites list of other documents given Okay, so by modifying the template cache files is not feasible to
provide a way to correct the following:
specifically
phpcms \ libs \ classes \ model.class.php 61 line
$ this-> pages = pages ($ this-> number, $ page , $ pagesize, $ urlrule, $ array, $ setpages);
the modifications to the above line:
$ this->
(Template to do {$ pages} {$ wz_pages})
The above is the first approach.
But this way, it may also affect the background, this place seems to be a lot of local control
can also be modified such that the file is still above the 61 line do not modify. Add line 61 directly below:
$ this-> wz_pages = wz_pages ($ this-> Number, Page $, $ pageSize, $ urlrule, Array $, $ setPages);
go to: phpcms \ modules \ member \ index.php line 718
to $ pages = $ this-> favorite_db-> pages;
revised as:
$ wz_pages = $ this-> favorite_db-> wz_pages;
template {$ pages} to modify {$ wz_pages}

Guess you like

Origin www.cnblogs.com/jxhgt/p/10969129.html