dongmi5015 2017-01-18 10:13
浏览 31
已采纳

在yii1中,分页不适用于CLinkPager

I used widget "clinkpager". It appears on page when i click on 2nd,3rd .... page. I wont moved on next page. Even next and previous also not works there.

<?php
$this->widget('CLinkPager', array(
'pages' => $pages, 
'currentPage'=>$pages->getCurrentPage(),
'pageSize'=>$page_size,     
'itemCount'=>$count,        
'header'=>'',
 ));?>

When i click on "next" then the url changed in the browser. http://localhost/mate/admin/site/pricelisting/89-Malouf-Zoned-Gel-Dough/page/2

but it will not move on 2nd page.

instead of above URL if i use below url then it move to the page http://localhost/mate/admin/site/pricelisting/89-Malouf-Zoned-Gel-Dough?page=2

.htaccss file


        RewriteEngine on

        RewriteCond %{HTTP_HOST} ^localhost/mate/admin$ [NC,OR]
        RewriteCond %{HTTP_HOST} ^localhost/mate/admin$

        RewriteCond %{REQUEST_URI} !wordpress/
        RewriteRule (.*) /wordpress/$1 [L]

        Options +FollowSymLinks -MultiViews
        RewriteEngine On

        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule .* index.php/$0 [PT,L]

        RewriteRule details/(.*)/(.*)/ site/details?id=$1&name=$2
        RewriteRule details/(.*)/(.*) site/details?id=$1&name=$2

        RewriteRule pricelisting/(.*)-(.*)/ site/pricelisting?id=$1&name=$2?page=$3 [L,QSA]
        RewriteRule pricelisting/(.*)-(.*) site/pricelisting?id=$1&name=$2?page=$3 [L,QSA]

        #RewriteRule pricelisting/(.*)-(.*)/ site/pricelisting?id=$1&name=$2
        #RewriteRule pricelisting/(.*)-(.*) site/pricelisting?id=$1&name=$2

        #RewriteRule pricelisting/(.*)-(.*)/page(.*)/ site/pricelisting?page=$3 [L,QSA]
        #RewriteRule pricelisting/(.*)-(.*)/page(.*) site/pricelisting?page=$3 [L,QSA]


        RewriteRule ^pricelisting/(.*)-(.*)/page(.*)/ site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]
        RewriteRule ^pricelisting/(.*)-(.*)/page(.*) site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]

I don't have any idea. Please suggest me what is wrong there.

  • 写回答

1条回答 默认 最新

  • duan4523 2017-01-18 10:38
    关注

    I think this is due to your rewrite rules

    RewriteRule ^pricelisting/(.*)-(.*)/page(.*)/ site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]
    RewriteRule ^pricelisting/(.*)-(.*)/page(.*) site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]
    

    They would reqrite [...]/page2to the according page, since there is a /missing between page and the number placeholder - if I'm not completely wrong. Change them to

    RewriteRule ^pricelisting/(.*)-(.*)/page/(.*)/ site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]
    RewriteRule ^pricelisting/(.*)-(.*)/page/(.*) site/pricelisting?id=$1&name=$2&page=$3 [L,QSA]
    

    and I believe that it should work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?