Codeigniter Slug - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Codeigniter Slug (/showthread.php?tid=75106) |
Codeigniter Slug - rmcdahal - 12-21-2019 Hello friends, I am having problems with slug in codeigniter4, I have a table called city which stores slug in slug columns Controller code Code: public function details($slug) Slug is stored in database as india for india entry india/delhi for delhi entry india/delhi/abc for abc entry The problem is when i access site using domain.com/india its working,if i access website as domain.com/india/delhi it still shows india only, My Route is Code: $routes->get('/(:any)', 'FrontPanel::details/$1/', ['namespace' => 'BasicApp\FrontPanel\Controllers']); Please help me where is the main issue ? RE: Codeigniter Slug - John_Betong - 12-22-2019 Try this: // The order is important $routes->get('/(:any)/(:any)/(:any)', 'FrontPanel::details/$1/$2/$3', ['namespace' => 'BasicApp\FrontPanel\Controllers']); $routes->get('/(:any)/(:any)', 'FrontPanel::details/$1/$2', ['namespace' => 'BasicApp\FrontPanel\Controllers']); $routes->get('/(:any)/(:any)/(:any)', 'FrontPanel::details/$1/$2/$3', ['namespace' => 'BasicApp\FrontPanel\Controllers']); $routes->get('/(:any)', 'FrontPanel::details/$1', ['namespace' => 'BasicApp\FrontPanel\Controllers']); |