duande1985
duande1985
2012-06-11 21:13

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

已采纳

I'm new in CodeIgniter and read user guide from website. Using pagination class, pagination can be made like :

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

But how can I make this pagination with alphabetical order? Thanks...

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • dtgv52982 dtgv52982 9年前

    Codeigniter pagination class is only for creating the navigation links. You have to write your script for populating these pages with data. So in your model query, you have to specify the order_by clause.

    点赞 评论 复制链接分享
  • dongling4383 dongling4383 7年前

    You can build new one as per your requirement. Already this topic is discussed in CI forum. Please check the forum link:

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

    点赞 评论 复制链接分享

相关推荐