Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set class name to <a> tag in CodeIgniter pagination

I need to set class name to <a> tag in CodeIgniter pagination. CodeIgniter's $this->pagination->create_links(); function creates links like this:

<a href="http://example.com/pages/3">3</a>

But, I need link like this:

<a href="http://example.com/pages/3" class="number">3</a>

How can I solve this problem?

like image 684
John Avatar asked Nov 28 '22 06:11

John


2 Answers

This is the below code using this you can add the class inside the anchor tag of pagination in Code Ignitor

$config['attributes'] = array('class' => 'myclass');
like image 84
Binayak Das Avatar answered Dec 19 '22 18:12

Binayak Das


Add

$config['anchor_class'] = 'class="number" ';

before

$this->pagination->initialize($config); 
like image 43
Valeh Hajiyev Avatar answered Dec 19 '22 19:12

Valeh Hajiyev