Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

Help with pagination

$
0
0
WARNING: It's not the usual paging post, but help finding the alternative to the usual one!

Hi guys, I had already found a working solution for paging, but it is not very beautiful at aesthetic level as it passes the numbers of the next results you intend to see like: index.php /?Page=5 (if the results are 5 at a time).

I would like the pages to be displayed like this: site.com/2 etc. etc

This is my controller, the paging works but once inside the page it shows me error 404.

Code:
public function index($offset = 0) {

       // Config setup
       $num_rows = $this->my_model_model->activePosts();
       $config['base_url'] = base_url();
       $config['total_rows'] = $num_rows;
       $config['per_page'] = 5;
       $config['num_links'] = $num_rows;
       $config['use_page_numbers'] = TRUE;
       $config['full_tag_open'] = '<ul class="pagination">';
       $config['full_tag_close'] = '</ul>';
       $config['prev_link'] = '&laquo;';
       $config['prev_tag_open'] = '<li>';
       $config['prev_tag_close'] = '</li>';
       $config['next_tag_open'] = '<li>';
       $config['next_tag_close'] = '</li>';
       $config['cur_tag_open'] = '<li class="active"><a href="#">';
       $config['cur_tag_close'] = '</a></li>';
       $config['num_tag_open'] = '<li>';
       $config['num_tag_close'] = '</li>';
       $config['next_link'] = '&raquo;';
       
       $this->pagination->initialize($config);
       
       $data['postes'] = $this->my_model_model->getActivePosts($config['per_page'], $offset);
       $data['categories'] = $this->secrets_model->getCategories(); // get categories

       $this->load->view('themes/default/header', $data);
       $this->load->view('index', $data);
       $this->load->view('themes/default/footer');
}


What am I wrong guys? I ask for your help because I'm months trying solutions

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>