Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CodeIgniter Pagination for Twitter Bootstrap

This uses Twitter Bootstrap classes for CodeIgniter pagination.

Drop this file into application/config.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Pagination Config
*
* Just applying codeigniter's standard pagination config with twitter
* bootstrap stylings
*
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @author Mike Funk
* @link http://codeigniter.com/user_guide/libraries/pagination.html
* @email mike@mikefunk.com
*
* @file pagination.php
* @version 1.3.1
* @date 03/12/2012
*
* Copyright (c) 2011
*/
// --------------------------------------------------------------------------
// $config['base_url'] = '';
$config['per_page'] = 2;
$config['uri_segment'] = 3;
$config['num_links'] = 9;
$config['page_query_string'] = TRUE;
// $config['use_page_numbers'] = TRUE;
$config['query_string_segment'] = 'page';
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div><!--pagination-->';
$config['first_link'] = '&laquo; First';
$config['first_tag_open'] = '<li class="prev page">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = 'Last &raquo;';
$config['last_tag_open'] = '<li class="next page">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = 'Next &rarr;';
$config['next_tag_open'] = '<li class="next page">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '&larr; Previous';
$config['prev_tag_open'] = '<li class="prev page">';
$config['prev_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li class="page">';
$config['num_tag_close'] = '</li>';
// $config['display_pages'] = FALSE;
//
$config['anchor_class'] = 'follow_link';
// --------------------------------------------------------------------------
/* End of file pagination.php */
/* Location: ./bookymark/application/config/pagination.php */
@Oussama-Tn

This comment has been minimized.

Copy link

@Oussama-Tn Oussama-Tn commented Nov 15, 2012

Thank you :)

@razorlegacy

This comment has been minimized.

Copy link

@razorlegacy razorlegacy commented Nov 20, 2012

Thank you :o)

@KyeRussell

This comment has been minimized.

Copy link

@KyeRussell KyeRussell commented Dec 11, 2012

You win! Thanks.

@lrandom

This comment has been minimized.

Copy link

@lrandom lrandom commented Dec 27, 2012

thank you, you rock :)

@vzhen

This comment has been minimized.

Copy link

@vzhen vzhen commented Jan 24, 2013

Thanks

@hedcler

This comment has been minimized.

Copy link

@hedcler hedcler commented Mar 21, 2013

Very good... Thanks!

@filipecrosk

This comment has been minimized.

Copy link

@filipecrosk filipecrosk commented May 17, 2013

thanks a lot guy

@thomaswelton

This comment has been minimized.

Copy link

@thomaswelton thomaswelton commented May 18, 2013

Started to write this myself, then googled it. Thanks man

@xavierpeyret

This comment has been minimized.

Copy link

@xavierpeyret xavierpeyret commented May 24, 2013

Good Job... Thanks!

@afbora

This comment has been minimized.

Copy link

@afbora afbora commented May 29, 2013

Really thanks!.. Its great ;)

@patrickegp

This comment has been minimized.

Copy link

@patrickegp patrickegp commented Jun 7, 2013

REALLYYYYYY THANKS MAn...

@isaiasmac

This comment has been minimized.

Copy link

@isaiasmac isaiasmac commented Jun 14, 2013

Thank you my friend. :D :D :D

@anherrera

This comment has been minimized.

Copy link

@anherrera anherrera commented Aug 21, 2013

Awesome, thank you very much for this contribution and saving me time!

@vivaserver

This comment has been minimized.

Copy link

@vivaserver vivaserver commented Sep 23, 2013

Works great! Thank you very much.

@scheffershen

This comment has been minimized.

Copy link

@scheffershen scheffershen commented Oct 8, 2013

Thank you very much.

@mephraums

This comment has been minimized.

Copy link

@mephraums mephraums commented Oct 15, 2013

Thank you saved me a lot of time! I did have to move the pagination class to the ul to get it working with bootstrap V3 - here http://getbootstrap.com/components/#pagination

@fabianoone

This comment has been minimized.

Copy link

@fabianoone fabianoone commented Oct 17, 2013

Nice, thanks buddy!

@fedmich

This comment has been minimized.

Copy link

@fedmich fedmich commented Nov 13, 2013

Thanks for this buddy.

I needed to edit my anchor_class on my app.

$config['anchor_class'] = 'class="follow_link"';

@EdnaldoNeimeg

This comment has been minimized.

Copy link

@EdnaldoNeimeg EdnaldoNeimeg commented Dec 20, 2013

Thanks a lot.

@andreaamado

This comment has been minimized.

Copy link

@andreaamado andreaamado commented Dec 23, 2013

Thanks

@abneralvarado

This comment has been minimized.

Copy link

@abneralvarado abneralvarado commented Apr 24, 2014

Thanks a lot!

@AzizHardaya

This comment has been minimized.

Copy link

@AzizHardaya AzizHardaya commented Apr 28, 2014

not work in bootstrap 3

@AzizHardaya

This comment has been minimized.

@maxehhh

This comment has been minimized.

Copy link

@maxehhh maxehhh commented Jun 30, 2014

Thanks! was looking for something like this :)

@Johndllee

This comment has been minimized.

Copy link

@Johndllee Johndllee commented Jul 24, 2014

Many Thank for this!

@d0n601

This comment has been minimized.

Copy link

@d0n601 d0n601 commented Oct 14, 2015

I had to modify line 30 to set the pagination class for the <ul> tag rather than the <div>, then all worked well. CI 3.02 with Bootstrap 3.3.5

$config['full_tag_open'] = '<div class="pagination"><ul>';

became

$config['full_tag_open'] = '<div><ul class="pagination">';

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Apr 4, 2016

thanks

@kashoutlook

This comment has been minimized.

Copy link

@kashoutlook kashoutlook commented Aug 30, 2016

amazing

@nyarilokak

This comment has been minimized.

Copy link

@nyarilokak nyarilokak commented Apr 25, 2017

Thx bro

@zoeeeeeeeeeeeeeee

This comment has been minimized.

Copy link

@zoeeeeeeeeeeeeeee zoeeeeeeeeeeeeeee commented May 10, 2017

Thank you very much and can you help me to rtl this?
Thanks a lot

@jos3neg

This comment has been minimized.

Copy link

@jos3neg jos3neg commented Aug 17, 2018

Thank you ..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment