尝试使用Kohana分页模块的问题

vin*_*n75 2 php pagination kohana

我从Git 下载了Kohana Pagination模块,并且在尝试使用它时遇到了一些问题.

我将它移动到modules文件夹并更新了我的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;
}
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中运行加载时,我收到以下错误消息...

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()
Run Code Online (Sandbox Code Playgroud)

如果我删除与分页相关的代码,页面将从数据库中加载数据.这里的任何指针都会很棒.


更新

发现此链接:https://github.com/kloopko/kohana-pagination,在Ikke的背面,所以为帮助人员欢呼.

看来先前捆绑的分页模块已被删除,发现kohana-pagination模块已更新为满足3.2.

希望能帮助别人刚开始.:)

小智 5

问题是版本3.2的配置系统已更改.大多数模块都可以通过简单更新来修复

$config_file = Kohana::config('pagination');
Run Code Online (Sandbox Code Playgroud)

$config_file = Kohana::$config->load('pagination');
Run Code Online (Sandbox Code Playgroud)