Welcome Guest, Not a member yet? Register   Sign In
Paging links do not change
#1

[eluser]Unknown[/eluser]
Hi guys, i'm new to this forum as well as to codeigniter.

till now i managed all very well and i must say i love to program in codeigniter.

now i have a small problem, the pagination active marker on the numbers stays on the 1 page.

paging is working fine and i have no errors, only the position of the links is not changing.

here is my model:

Code:
public function getAll($sort, $order, $num, $offset)
{
  $this->db->from('listings');
  $this->db->where(array('p_active' => 1));
  $this->db->order_by($sort, $order);
  $this->db->limit($num, $offset);
  $query = $this->db->get();
  return $query->result();
  
  
}

my Controller
Code:
public function results()
{
  // Load pagination
  $this->load->library('pagination');
     if ($this->uri->segment(3) == TRUE || $this->uri->segment(4) == TRUE){
      $sort = $this->uri->segment(3);
      $order = $this->uri->segment(4);
     } else {
      $sort = 'p_price';
      $order = 'asc';
     }
  $config['base_url'] = base_url().'listings/results/'.$sort.'/'.$order.'/';
  $this->db->like('p_active', 1);
  $this->db->from('listings');  
  $config['total_rows'] = $this->db->count_all_results();
  $config['per_page'] = 5;
     $config['full_tag_open'] = '<p>';
     $config['full_tag_close'] = '</p>';

     $this->pagination->initialize($config);

  // Get data from model
  $data['results'] = $this->listing->getAll($sort, $order, $config['per_page'],$this->uri->segment(5));

  $this->load->view(TEMPLATE_PATH.'/results.php', $data);
}

and for the view i use
Code:
&lt;?php echo $this->pagination->create_links(); ?&gt;

please if somebody had the same problem or something similar i would be very happy to solve this issue.

in this case .. MERRY CHRISTMAS ..





Theme © iAndrew 2016 - Forum software by © MyBB