duande1985 2012-06-11 21:13
浏览 66
已采纳

如何在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 2012-06-11 21:24
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改
  • ¥15 Windows 系统cmd后提示“加载用户设置时遇到错误”
  • ¥50 vue router 动态路由问题
  • ¥15 关于#.net#的问题:End Function
  • ¥15 无法import pycausal
  • ¥15 weditor无法连接模拟器Local server not started, start with?
  • ¥20 6-3 String类定义
  • ¥15 嵌入式--定时器使用