UMDEVELOPER
UMDEVELOPER

Reputation: 89

how to make dynamic each function name of controller in codeigniter

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

Answers (2)

AldoZumaran
AldoZumaran

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

Muhammad Azam
Muhammad Azam

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

Related Questions