Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to define pagination in Codelgniter

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 124
    Comment on it

    Hello Friends,

    Pagination is the basic component of listing pages. If you are new in Codelgniter and want to use paging in your listing pages. Please follow the below code for the same:
    1) Open your listing controller where you want to show listing

    // define paging library
    $this->load->library('pagination');
    
    //set your listing page path like in the below line users in my controller name and flag is the controller function make sure /page/ put in the last 
    $config['base_url'] = URL . 'users/flags/page/';
    
    // set total number of records here
    $config['total_rows'] = $nos_allFlags;
    
    // set records per page
    $config['per_page'] = 20;
    
    // Initialize paging
    $this->pagination->initialize($config);
    

    2) Now open your view file and put the below code where you would like to show paging

    echo $this->pagination->create_links();

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: