user4621797
user4621797

Reputation:

codeigniter inherints controller from controller

I have Admin.php as contrller for dashboard,signin and logout but in my application the admin user can edit news or add news I wanna separate news & admin controller and news controller work under admin
to understand my I wanna URL like http://localhost/nkmf/admin/
after admin if I write news get my news dashboard
and the URL be Like: http://localhost/nkmf/admin/news/
and after news if I enter editeNews open editing form for selected news
and URL be like http://localhost/nkmf/admin/news/editNews?id=

Upvotes: 0

Views: 36

Answers (2)

Vijay Wilson
Vijay Wilson

Reputation: 516

As far as I have understood from your question the way you can achieve this is by either creating or overriding the .htaccess file or routes method. In which define your required url which leads to the the particular filename.php file. But for this you must know how to access and define the .htacess file or the routes class. If you are capable of handling htaccess file with regex, then you got it

Remember the codeIgniter url structure is http(s)://domain_name/sub_division/controller_name/function_name/parameter

Upvotes: 0

Hisham
Hisham

Reputation: 99

create sub folders named admin,news in controller folder

move your admin.php controller to the new subfolder named admin.

so you can access it by

http://localhost/appname/admin/controller_name/function_name

Upvotes: 0

Related Questions