Kohana 3.2 中最小、完整的分页示例是什么?
我在 Kohana 3.2 中找到了很多有关分页的信息,但其中大部分分散在论坛评论和博客文章中,没有单一完整的来源可供参考。
(注:我本来打算自我回答这个问题)
I found much information about pagination in Kohana 3.2 but most of it is scattered across forum comments and blog posts with no single complete source to refer to.
(note: I intended to self answer this question)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我有用:
在bootstrap.php中添加模块:
将配置文件从modules/pagination/config/pagination.php复制到application/config/pagination.php。
将以下操作添加到您的控制器:
创建您的视图/页面,如下所示:
<前><代码>
根据您的需要修改 application/config/pagination.php。我必须将
'view'
参数更改为'pagination/floating'
,当页面列表太大时,它会显示省略号 (...),这与默认的 < code>'pagination/basic' 列出所有页面,无论长度如何。This is what worked for me:
Add the module in bootstrap.php:
Copy the configuration file from modules/pagination/config/pagination.php to application/config/pagination.php.
Add the following actions to your controller:
Create yourview/page as follows:
Modify application/config/pagination.php according to your needs. I had to change the
'view'
parameter to'pagination/floating'
which displays ellipses (...) when the list of pages is too large, unlike the default'pagination/basic'
which lists all pages regardless of length.Kohana 3.2 最初不支持分页。幸运的是,有人更新了该模块,您可以在 https://github.com/kloopko/kohana 获取代码-分页
Pagination wasn't originally working/supported in Kohana 3.2. Luckily, somebody has updated the module and you can get the code at https://github.com/kloopko/kohana-pagination