Admin CP and Sub-Directory |
At the second point in this guide https://philsturgeon.uk/blog/2009/07/Cre...deIgniter/ talks about the sub-directory for create an admin cp and the routers.
But my question is: How create a general route for every controller that I create in the sub-directory "admin" for example? And when I write $route[‘admin’] = ‘admin/dashboard’; codeigniter should not look for the controller "admin" with the method "Dashboard"? Sorry for the questions, I have probably done a bit of confusion. Could you explain how to create an admin cp using subdirectories? Thanks for the reply.
You dont need any routes for this, CI will work out of the box. CI automaticly detects a folder like 'admin' with one or more controllerfiles (like Login.php) in it and adds a internal route for site.com/admin/login. Atleast At the top of my head I cant recall modifing the routes manual for this.
Please mind that the tutorial is from 2009(!), a few things have chenged since then, one for example wich could explain your issue is that controller files now should start with a capital character, try renameing your file to admin/Dashboard.php and check the upgrade documentation for other changes that might effect you if you try examples from so long ago.
I'M not sure about what diedErik says... I not saying that it's false. But for me I'M using admin.pop file to handle admin cp. You can check how it's done here https://github.com/Blair2004/tendoo-cms/...hboard.php
NexoPOS 2.6.2 available on CodeCanyon.
What @Diederik said. Especially the part with the 2009... Also, in order to make some publicity for my site
![]() Website: http://avenir.ro
(06-08-2015, 01:02 AM)Avenirer Wrote: What @Diederik said. Especially the part with the 2009... Also, in order to make some publicity for my site Thanks for all reply ![]() I follow Avenirer's guide. And I read the Step 1. I wonder, I'll have to specify the routes for each controller? Or is there a way to automate the process as it normally should be?
Not really, as this is only a sort of elegant way to "redirect" someone who simply introduces 'admin' in the url. After that you will do all anchors to where you need to send people.
Website: http://avenir.ro
Maybe we have not understood
![]() When you go to create a controller normally, this is automatically read by codeigniter. This is done even now? Or should I always specify that the controller x equals the routes x?
that's the default behavior. But if you want this url "http://site.com/admin" open application/controllers/dashboard.php instead, you should mention it on routes config file.
NexoPOS 2.6.2 available on CodeCanyon.
When using a subdir for a controller, I usually just need to add ONE route, and that's to go to a controller if someone only went to the dir (/admin) without supplying a controller.
$route['admin'] = 'admin/controller/method'; |
Welcome Guest, Not a member yet? Register Sign In |