我已经下载了 Kohana Pagination module来自 Git,在尝试使用它时遇到了一些问题。
我将它移到了模块文件夹中并更新了我的 Bootstrap 以包含该模块... 'pagination' => MODPATH.'kohana-pagination',
我有以下代码,可以从一个带有分页的简单表格中加载一些消息...
public function action_index()
{
$content = View::factory('welcome')
->bind('messages', $messages)
->bind('pager_links', $pager_links);
$message = new Model_Message;
$message_count = $message->count_all();
$pagination = Pagination::factory(array(
'total_items' => $message_count,
'items_per_page' => 3,
));
$pager_links = $pagination->render();
$messages = $message->get_all($pagination->items_per_page, $pagination->offset);
$this->template->content = $content;
}
当我在浏览器中运行 load this 时,我收到以下错误消息...
ErrorException [ Fatal Error ]: 1Call to undefined method Kohana::config()
MODPATH\kohana-pagination\classes\kohana\pagination.php [ 87 ]
82 * @return array config settings
83 */
84 public function config_group($group = 'default')
85 {
86 // Load the pagination config file
87 $config_file = Kohana::config('pagination');
88
89 // Initialize the $config array
90 $config['group'] = (string) $group;
91
92 // Recursively load requested config groups
{PHP internal call} » Kohana_Core::shutdown_handler()
如果我删除与分页相关的代码,该页面会很好地从数据库加载数据。这里的任何指示都会很棒。
更新
找到此链接:https://github.com/kloopko/kohana-pagination ,在 Ikke 的支持下,为有帮助的人们干杯。
似乎之前捆绑的分页模块已被删除,找到了已更新以适应 3.2 的 kohana-pagination 模块。
希望对刚起步的其他人有所帮助。 :)
最佳答案
问题只是 3.2 版的配置系统发生了变化。大多数模块可以通过简单的更新来修复
$config_file = Kohana::config('pagination');
到
$config_file = Kohana::$config->load('pagination');
关于php - 尝试使用 Kohana 分页模块的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7731385/