Autoload Config for Pagination in CodeIgniter not working

♀尐吖头ヾ 提交于 2019-12-05 16:46:42

Finally used this code to solve my problem...

$this->config->load("pagination");
$page_limit = $this->config->item("per_page");
$config['total_rows'] = $var; // Some variable count
$this->pagination->initialize($config);

This lets me define the config items in a file as well as initialize the items I want in controller like in my case, the total no. of rows - retrieved from database.

Regards

Your autoload line in your config file should be this

$autoload['libraries'] = array('pagination');

And you must have this line in you controller after your config array, before you use create_links() etc.

$this->pagination->initialize($config);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!