Welcome Guest, Not a member yet? Register   Sign In
Pagination active link help
#1

[eluser]Usama Aziz[/eluser]
I configured the pagination.
this is my controller

Code:
public function category(){
  $this->load->library('table');
  
    $subCatLink = $this->uri->segment(3);
  $pageId = $this->uri->segment(4);
   $this->load->helper('date');

   $subCatLink_array = explode('-',$subCatLink);
$subCat_id = $subCatLink_array['1'];

$this->db->select('*');
$this->db->from('adverts');
$this->db->where('subCategory_id',$subCat_id);
$this->db->limit(5,$pageId);
$queryAdverts = $this->db->get();

$queryAdvertss = $this->db->get_where('adverts', array('subCategory_id'=>$subCat_id));
  $data['base']=$this->config->item('base_url');
/*pagination start */  
  $config['base_url'] = base_url('/index.php/adverts/category/' . $subCatLink . '/');  
  
$config['total_rows'] = $queryAdvertss->num_rows();
$config['per_page'] = 5;
  $config['next_link'] = 'Next >';
  $config['prev_link'] = '< Previous ';
  $config['page_query_string'] = FALSE;
  
$config['num_links']='10';


$this->pagination->initialize($config);
$data['pagination']=$this->pagination->create_links();
  
  /*pagination End */
  
  
  

$data['queryAdverts'] = $queryAdverts;

$this->load->view('adverts',$data);

the problem i m facing my pagination current link dosent work. crunt class alwasy on 1 Sad
#2

[eluser]Aken[/eluser]
Read the User Guide page, look for the "uri_segment" config item. You need to tell the pagination class where to look for the page number, otherwise it won't know.
#3

[eluser]Usama Aziz[/eluser]
Code:
&lt;?php echo $pagination;
?&gt;
this is echo of my pagination.
#4

[eluser]Usama Aziz[/eluser]
thanks.
solved it Smile
Love codeigniter <3




Theme © iAndrew 2016 - Forum software by © MyBB