.htaccess - Query string in URL -
so i've taken on project friend of mine had started didn't have time finish. it's online e-commerce system built codeigniter. problem is, every product's url setup site.com/store/viewproduct?id=3
id identifier. okay keeping id in url, make ?
removed , product title added in well. final url site.com/store/viewproduct/3/cake-cutter
or that.
the controller functions reference $_get['id'];
well. know have change well... what?
i tried changing urls shown above , using $this->uri->segment(1,0);
product id, got error.
i use codeigniters built in url_title();
function generate product names, easiest way go changing these urls?
the best thing change way controller getting id. assuming don't need 4th uri segment , seo/usability purposes... if do, still way function set up.
class store extends ci_controller { //site.com/store/viewproduct/3/cake-cutter public function viewproduct($id, $name) { //do stuff , have access $id , $name //$id == 3 //$name == 'cake-cutter' } }
Comments
Post a Comment