简体   繁体   中英

How to make pagination with letters in 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...

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM