$category_id=$_GET['category_id'];
$data['adsd']=$this->mymodel->select_ads_by_category($category_id);
$config["base_url"]=site_url('main/category_ads_display?category_id='.$category_id.'');
$config["total_rows"]=count($data['adsd']);
$limit=$config["per_page"]=1;
$config["uri_segment"]=3;
$config["use_page_numbers"]=TRUE;
$this->pagination->initialize($config);
if($this->uri->segment(3))
$page=($this->uri->segment(3)-1)*$limit;
else
$page=0;
Hello friends i have pasted my code above,,everything is working fine,but when i click on links of pagination the url is like this =localhost/blabla/main/category_ads_display?category_id=5/2(not working)
but i need the url to be as = localhost/blabla/main/category_ads_display/2?category_id=5(working) please help me on this
Try this way
$category_id=$this->uri->segment(3);
$data['adsd']=$this->mymodel->select_ads_by_category($category_id);
config["base_url"]=site_url('main/category_ads_display/'.$category_id);
$config["total_rows"]=count($data['adsd']);
$limit=$config["per_page"]=1;
$config["uri_segment"]=4;
$config["use_page_numbers"]=TRUE;
$this->pagination->initialize($config);
if($this->uri->segment(4))
$page=($this->uri->segment(3)-1)*$limit;
else
$page=0;
Now your new link will be like this localhost/blabla/main/category_ads_display/5/2
for page 2 and 5 will be your category id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.