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

css - Text drops down with smaller window -

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

ruby on rails - Authlogic - how to make a registration and don't log in the new account? -