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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题