Welcome Guest, Not a member yet? Register   Sign In
Pagination configuration bug or incorrect documentation?
#3

[eluser]Harold Villacorte[/eluser]
This fixes the bug. The code in the constructor doesn't work so it has to happen in the initialize method.
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* Extends the CodeIgniter Pagination library.
*/
class MY_Pagination extends CI_Pagination
{
    /**
  * Initialize Preferences
  *
  * @access public
  * @param array initialization parameters
  * @return void
  */
function initialize($params = array())
{
  if (count($params) > 0)
  {
   foreach ($params as $key => $val)
   {
    if (isset($this->$key))
    {
     $this->$key = $val;
    }

    //------- The extension  ------------------------------------------//
    if ($key == 'anchor_class' && $val != '')
    {
        $this->anchor_class = 'class="' . $val . '" ';
    }
    //------- End extension  ------------------------------------------//

   }
  }
}
}
// END MY_Pagination Class

/* End of file MY_Pagination.php */
/* Location: ./application/libraries/MY_Pagination.php */


Messages In This Thread
Pagination configuration bug or incorrect documentation? - by El Forum - 04-27-2013, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB