Welcome Guest, Not a member yet? Register   Sign In
anchor_class not used properly in initialize() of Pagination class
#1

[eluser]Unknown[/eluser]
Hi guys,

When using the Pagination class I found something not properly working.

What works as expected based on the documentation (http://ellislab.com/codeigniter/user-gui...ation.html) is:

config/pagination.php with:
Code:
$config['anchor_class'] = 'class_name';

And in the controller:
Code:
$this->load->library('pagination');

Which executes:
Code:
public function __construct($params = array())
{
  if (count($params) > 0)
  {
   $this->initialize($params);
  }

  if ($this->anchor_class != '')
  {
   $this->anchor_class = 'class="'.$this->anchor_class.'" ';
  }

  log_message('debug', "Pagination Class Initialized");
}

But, when using your own config with this code in the controller:

Code:
$this->load->library('pagination');
$config = array('anchor_class' => 'class_name');
$this->pagination->initialize($config);

Executes first the __construct() as above shown (but 'anchor_class' is not set yet). Initialize executes:

Code:
function initialize($params = array())
{
  if (count($params) > 0)
  {
   foreach ($params as $key => $val)
   {
    if (isset($this->$key))
    {
     $this->$key = $val;
    }
   }
  }
}

So, the "class=" part is not included over here, which results in bad HTML code:

Code:
<a class_namehref="">..

Instead of:
Code:
<a class="class_name" href="">..

I think it is a bug (or not meant in the documentation atleast), but I can't figure out how to file a real report bug out of it..

Regards,
Stefan
#2

[eluser]skunkbad[/eluser]
You are right, because this is happening to me too. It seems fixed in the repo on Github.




Theme © iAndrew 2016 - Forum software by © MyBB