![]() |
How to replace underscore with hyphen ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18) +--- Thread: How to replace underscore with hyphen ? (/showthread.php?tid=308) |
How to replace underscore with hyphen ? - Prasanth - 11-20-2014 I know we can declare that in config/routes.php but is there any other solution since there are a lot of controllers ... RE: How to replace underscore with hyphen ? - Rufnex - 11-20-2014 Yes, you can declare it on every depending route or with a global config in rutes: $route['translate_uri_dashes'] = true|false; See here for details (on the bottom): http://www.codeigniter.com/userguide3/general/routing.html?highlight=translate_uri_dashes Does this work for you? Otherwise you have to overwrite the CI_Router Class. RE: How to replace underscore with hyphen ? - Narf - 11-21-2014 (11-20-2014, 09:40 AM)Rufnex Wrote: Yes, you can declare it on every depending route or with a global config in rutes: That's a CI3 feature. RE: How to replace underscore with hyphen ? - Rufnex - 11-21-2014 @Narf: your right .. i dont looked at the board title. Ok again, there are some usefull examples arround the web. The goal is to overwrite the routing class with an own logic like Create a file in 'application/core' and name it to 'MY_Router.php' PHP Code: class MY_Router extends CI_Router A more complex solution are described here http://upshots.org/php/codeigniter-hyphenated-urls |