Advertisement
petrabarus

Yii CPagination Fix

Aug 1st, 2011
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * An extension for pagination class.
  5.  *
  6.  * @author Petra Barus <[email protected]>
  7.  */
  8. class MPagination extends CPagination {
  9.  
  10.     /**
  11.      * Creates the URL suitable for pagination. This method is overriden to add
  12.      * a new functionality so that createURL could show page param = 1 for the
  13.      * first page links.
  14.      */
  15.     public function createPageUrl($controller, $page) {
  16.         $params = $this->params === null ? $_GET : $this->params;
  17.         $params[$this->pageVar] = $page + 1;
  18.         return $controller->createUrl($this->route, $params);
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement