Search code examples
codeigniterpaginationpyrocms

Pagination on Pyrocms pages


I am currently displaying a list of products on pyrocms page. Using plugin i get the products from db tables and display them as a list i want to use pagination but have no idea how to use it and where to start from. Does any one know any tutorial or have some suggstion?


Solution

  • Pyrocms used codeigniter framework this code works perfectly in case of module but i have never tried this on a plugin but still you can try this.

    Load pagination library in Controller

    $this->load->library('pagination');
    
    $config['base_url'] = 'http://example.com/index.php/test/page/';
    $config['total_rows'] = 200;
    $config['per_page'] = 20;
    
    $this->pagination->initialize($config);
    

    Use this code in view to genrate the links

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