In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about where to change the phpcms paging function. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
The phpcms paging function is modified in the global file "phpcms\ libs\ functions\ global.func.php". Its paging function refers to the "pages ()" function, which is shared by the whole site.
Phpcms V9 custom paging function
When you do a website, most of the time, the paging style may have to be controlled according to the requirements of the template. at this time, many people will modify the pages () function in the global file phpcms\ libs\ functions\ global.func.php, so the problem arises: this paging function will also affect the background, that is to say, this paging function is shared by the whole site.
The following solutions are provided: (this file has to be modified, and remember to back it up before modification)
open
Phpcms\ libs\ functions\ global.func.php file, find the paging function, copy it, paste it under the default paging function, and rename it. For example, mine is named wz_pages, and save.
open
Phpcms/libs/classes/template_cache.class.php, find $str. ='$pages = pages ($'. $op.'_total, $page, $pagesize, $urlrule) on line 207,
Add at the bottom of the line
$str. ='$wz_pages = wz_pages ($'. $op.'_total, $page, $pagesize, $urlrule);
Save.
Finally, if you want to use your custom paging function, you can use {$wz_pages} directly in the template.
To modify the style in the future, modify it directly
The wz_pages function in the file phpcms\ libs\ functions\ global.func.php is fine and will not affect the background.
That's all I can express. If you don't understand, please post it back.
Follow-up optimization:
In the course of use, it is found that the use of SQL paging can not be used normally, you have to add the following code
open
Phpcms/libs/classes/template_cache.class.php, find $str. ='$r = $get_db- > sql_query ("'.$ sql.'"); $s = $get_db- > fetch_next (); $pages=pages ($[\ 'count\'], $page, $pagesize, $urlrule);'
Add to him below:
$str. ='$r = $get_db- > sql_query ("'.$ sql.'"); $s = $get_db- > fetch_next (); $wz_pages=wz_pages ($[\ 'count\'], $page, $pagesize, $urlrule);'
In this way, the SQL pagination is also normal, hey, welcome to shoot bricks, do not shoot, you have to top ah ~
Follow-up optimization again:
A friend mentioned that the above method cannot be used in the paging of the favorites list of the member center.
Because the paging function of the favorite list is set directly in other files, it is not feasible to cache the file by modifying the template.
Here are some ways to modify it:
Specifically
Phpcms\ libs\ classes\ model.class.php 61 line $this- > pages = pages ($this- > number, $page, $pagesize, $urlrule, $array, $setpages)
Change the above line to:
$this- > pages = wz_pages ($this- > number, $page, $pagesize, $urlrule, $array, $setpages); ({$pages} in the template does not need to be changed to {$wz_pages})
The above is the first way.
However, in this case, it may also be affected backstage. This place seems to control a lot of places.
Can also be modified in this way, or the above file, line 61 do not modify. Add directly below line 61:
$this- > wz_pages= wz_pages ($this- > number, $page, $pagesize, $urlrule, $array, $setpages)
Then go to: line phpcms\ modules\ member\ index.php 718
Put $pages = $this- > favorite_db- > pages
Modified to:
$wz_pages = $this- > favorite_db- > wz_pages
{$pages} in the template to be modified to {$wz_pages}
The above is the editor for you to share where to change the phpcms paging function, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.