如何在CodeIgniter中对字母进行分页?

时间:2012-06-11 21:13:23

标签: php codeigniter pagination

我是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();
    }
}
?>  

但是如何按字母顺序进行分页呢?感谢...

2 个答案:

答案 0 :(得分:2)

Codeigniter分页类仅用于创建导航链接。您必须编写脚本以使用数据填充这些页面。因此,在模型查询中,您必须指定order_by子句。

答案 1 :(得分:0)

您可以根据自己的要求建立新的。这个话题已经在CI论坛中讨论过了。 请查看论坛链接:

http://ellislab.com/forums/viewthread/164849/