我是CodeIgniter的新手,从网站上阅读用户指南。使用分页类,可以像这样进行分页:
<?php
class Test extends CI_Controller {
function page(){
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/CodeIgniter/index.php/test/page/';
$config['total_rows'] = 20;
$config['per_page'] = 1;
$this->pagination->initialize($config);
echo $this->pagination->create_links();
}
}
?>
但是我怎样才能按字母顺序进行这种分页呢?谢谢。。。
Codeigniter 分页类仅用于创建导航链接。您必须编写脚本以使用数据填充这些页面。因此,在模型查询中,必须指定 order_by 子句。
您可以根据需要构建新的。这个话题已经在CI论坛中讨论过了。请查看论坛链接:
http://ellislab.com/forums/viewthread/164849/