Welcome Guest, Not a member yet? Register   Sign In
Improve url pagination
#1

Hi guys, you had already helped me with the pagination but unfortunately I can not improve the url part.

I would like the various pages to be displayed this way: mysite.com/2 or mysite.com/page/2 etc. etc

Instead, my pages are shown at this time: mysite.com/?per_page=2


This is my controller:

PHP Code:
   public function index() {
 
       $offset 0;
 
       if ($this->input->get('per_page') != null) {
 
           $offset $this->input->get('per_page');
 
       }
 
       
        $count 
6//number of posts in page 
 
       $filter = array();
 
       $data['post_count'] = $this->post_model->get_active_post($filter);
 
       $data['title'] = 'Post';
 
       $data['desc'] = 'Enter the description of this page index';
 
       $data['post'] = $this->post_model->get_index($filter$count$offset); 
 
       $config['base_url'] = base_url();
 
       $config['total_rows'] = $data['post_count'];
 
       $config['per_page'] = $count;
 
       $config['next_link'] = "next →";
 
       $config['prev_link'] = "← previous";
 
       $this->pagination->initialize($config);
 
       $data['pagination'] = $this->pagination->create_links();
 
       
        $this
->load->view('templates/header'$data);
 
       $this->load->view('index'$data);
 
     
Reply
#2

Make sure these are set correctly:

PHP Code:
// Pagination config
// Make sure this is set to TRUE
$config[‘page_query_string’] = TRUE;

// ./application/config/config.php
// Make sure this is set to FALSE
$config['page_query_string'] = FALSE
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I tried, but nothing. If anyone can help me, thank you very much
Reply




Theme © iAndrew 2016 - Forum software by © MyBB