简体   繁体   中英

Issue with URL in CodeIgniter

I am facing an issue with my site on cars - Now the problem i am facing with CodeIgniter is that on "new car" section if I select make, the URL is like below.

http://carandme.com/new-cars/ashok-leyland-cars-in-india?car_type=new&car_type_id=1&maker_id=106&maker_identifier=ashok_leyland&model_id=&model_identifier=

but I want a URL like this.

http://carandme.com/new-cars/ashok-leyland-cars-in-india

Similarly I am also facing issue in refine search on same page ie if I select two car, the URL doesn't changes but the parameters do. Is there any way for this to be without parameter.

$input1 = $this->input->post('user_search1'); $input2 = $this->input->post('user_search2');

$user_input = array($input1, $input2); //making array of user search Inputs $search_field_name = array("search_col_name1", "search_col_name2"); //original column name of table fro searching

//combining to send it as uri latter $searchparams_uri = array_combine($search_field_name, $user_input);

//removing the keys and values from the array if Values is null or not set $searchparams_uri = array_filter($searchparams_uri);

// Convert to associative array $this->terms_uri to segments to append to base_url $keys = $this->uri->assoc_to_uri($this->terms);

$this->load->library('pagination'); $config['base_url'] = base_url().'index.php/controller/method_name/'.'/'.$keys.'/';

You will get URL like this: index.php/controller/method_name/search_col_name1/input1/search_col_name1/input1

Break and Make according to your need. Question are welcome.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM