phpcms可以使用2个不同的分页样式吗
phpcms可以使用2个不同的分页样式吗?
我按照网上的方法
打开
phpcms/libs/classes/template_cache.class.php,找到207行的
$str .= '$pages = pages($'.$op.'_total, $page, $pagesize, $urlrule);';
在这行的下面加上
$str .= '$wz_pages = wz_pages($'.$op.'_total, $page, $pagesize, $urlrule);';
保存。
然后修改了自定义的方法
function zbpages($num, $curr_page, $perpage = 3, $urlrule = '', $array = array(),$setpages = 10) { if(defined('URLRULE') && $urlrule == '') { $urlrule = URLRULE; $array = $GLOBALS['URL_ARRAY']; } elseif($urlrule == '') { $urlrule = url_par('page={$page}'); } $multipage = ''; if($num > $perpage) { $page = $setpages+1; $offset = ceil($setpages/2-1); $pages = ceil($num / $perpage); if (defined('IN_ADMIN') && !defined('PAGES')) define('PAGES', $pages); $from = $curr_page - $offset; $to = $curr_page + $offset; $more = 0; if($page >= $pages) { $from = 2; $to = $pages-1; } else { if($from <= 1) { $to = $page-1; $from = 2; } elseif($to >= $pages) { $from = $pages-($page-2); $to = $pages-1; } $more = 1; } if($curr_page>0) { $multipage =$pages.'</span><ul><li> <a href="'.pageurl($urlrule, $curr_page-1, $array).'" class="a1"><</a></li>'; } $multipage = '<div class="pages right"><span><b>'.$curr_page.'</b>/'.$multipage ; if($curr_page<$pages) { $multipage .= ' <li><a href="'.pageurl($urlrule, $curr_page+1, $array).'" class="a1">></a></li></ul></div>'; } elseif($curr_page==$pages) { $multipage .= ' <li><a class="a1">></a></li></ul></div>'; } else { $multipage .= ' <li><a href="'.pageurl($urlrule, $curr_page+1, $array).'" class="a1">></a></li></ul></div>'; } } echo $multipage;}
可以修改成功了,但是我想要调用默认的样式的话,总会把修改后的样式再输出一次,麻烦高手帮忙看下!
回复讨论(解决方案)
没人么.求帮忙~
我没用过 phpcms,只能做些推断
根据你的描述:
$str .= '$pages = pages($'.$op.'_total, $page, $pagesize, $urlrule);'; //这是原来的
$str .= '$wz_pages = wz_pages($'.$op.'_total, $page, $pagesize, $urlrule);'; //这是为自定义样式增加的
显然在使用默认样式的时候,后一句是不需要有的。应注释掉
你找到的这个方法明显是不合理的,phpcms 作为成品的系统,应该有动态设置样式的地方,只是你没找到
我没用过 phpcms,只能做些推断
根据你的描述:
$str .= '$pages = pages($'.$op.'_total, $page, $pagesize, $urlrule);'; //这是原来的
$str .= '$wz_pages = wz_pages($'.$op.'_total, $page, $pagesize, $urlrule);'; //这是为自定义样式增加的
显然在使用默认样式的时候,后一句是不需要有的。应注释掉
你找到的这个方法明显是不合理的,phpcms 作为成品的系统,应该有动态设置样式的地方,只是你没找到
恩,感谢,~ 是否对原来的代码或者默认样式有影响. 我主要是想知道这个.
我感觉 他只是多解析了 一个 $WZ_pages , 不会对 $pages 有影响,
不过不知道为什么调用$pages 会多调用一次修改后的样式.感谢赐教~
找到原因了.... echo 和return 的事... 程序调用的时候,会输出..

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
