How to get page number in Yii -


i using yii show list page, shown in several pages automatic via zii.widgets.clistview.

when user click next page, url not change. need know page user viewing.

how can page number in yii?

disable ajax on cviewlist with 'ajaxupdate'=>false

you wont current page number directly because of ajax calls. if disable ajax clistview can able current page numbers on page load.

my sample controller

     <?php      $dataprovider = new cactivedataprovider('mymodel', array('pagination' => array('pagesize' => 3)));      $this->render('myviewpage', array('dataprovider' => $dataprovider));      ?> 

now check view

    <?php     $this->widget('zii.widgets.grid.cgridview',          array(                 'dataprovider' => $dataprovider,                 'ajaxupdate'=>false             ));      echo "current page number is: ".(int)($dataprovider->pagination->getcurrentpage()+1);     ?> 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -