Reputation: 89
I want to dynamic function name of controller in codeigniter like:
$functionName = 'profile';
function $functionName(){
------
-----
-----
}
Actually I want to change url http://website/manage/viewprfile/Username to http://website/manage/profile/Username and that url is used in whole website.
Upvotes: 1
Views: 1534
Reputation: 572
jus add this routes in application/config/routes.php
$route['manage'] = 'manage/index';
$route['manage/(:any)'] = 'manage/$1';
now u can access to manage/profile/username, manage/somethingelse
Upvotes: 1
Reputation: 328
the simple way is to write route rules in following way$route['manage/prfile '] = 'manage/viewprfile';
this will change your URL to specific that you want.
Other way is to create a hook for rewriting your URL.
Upvotes: 0