【发布时间】:2018-02-10 01:41:44
【问题描述】:
到目前为止,我已设置 CI 分页并按预期工作。正如 CI 文档中所建议的那样,我正在使用分页配置文件。我选择这样做是为了保持控制器整洁。我遇到的问题是我不知道如何访问和覆盖 total_rows 变量。
例如,我在配置文件中将变量设置为 200。在我的应用程序中,记录数会更高。我想在控制器中本地动态修改变量。
我可以使用“print_r($this->pagination);”查看对象内容(如下)
CI_Pagination Object
(
[base_url:protected] => http://moxietek.com/mx03/index.php/user/index/
[prefix:protected] =>
[suffix:protected] =>
[total_rows:protected] => 200
[num_links:protected] => 3
[per_page] => 20
[cur_page] => 0
[use_page_numbers:protected] =>
[first_link:protected] => First
[next_link:protected] => Next
[prev_link:protected] => Previous
[last_link:protected] => Last
...)
在分页问答中,每个都使用控制器中的配置设置。我可以做到这一点,一切都会奏效,但我最终想为其他控制器重用分页配置。谢谢。
【问题讨论】:
标签: php codeigniter pagination