Route Big Question |
Hi. It is possible to make a route like this:
PHP Code: $route['search/(:any)/(:any)/(:any)/?search=(:any)'] = 'servers/search/$1/$2/$3/?search=$4'; // Search by Type / Game / Location / Keywords I have a script like GameTracker (if you know the website) and I would like to create a search with some features. But, also I would like to let visitors to query by words. My question: How can I make an URL which allows me to query even words ? Example: PHP Code: http://localhost/search/nameorip/csgo/UK/?search=codeigniter.com Any idea ? I need to write .htaccess ? P.S: I try to rewrite this script with Codeigniter. When was raw PHP I had this code: PHP Code: RewriteCond %{QUERY_STRING} ^matching=([^&]+)$ [NC]
I would highly recommend doing something more along the lines of
Code: http://localhost/search?nameorip=$var&csgo=$var&country=$var&query=$var Otherwise, the standard .htaccess should work. Be sure to follow the routing rules found in the documentation. Order of routes is very important.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
(05-10-2016, 11:21 AM)albertleao Wrote: I would highly recommend doing something more along the lines of Ok, but my config is set to using default , i mean site like this domain.com/controller/method/etc/ and I can't use it like that...
Yes, you can.
Use $this->input->get('nameorip') to fetch the parameters in the url.
Use the URI Class:
PHP Code: $uri = $this->uri->segment(3, 0); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |