• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Admin CP and Sub-Directory

#1
Exclamation 
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.
Reply

#2
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.
Reply

#3
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.
Reply

#4
What @Diederik said. Especially the part with the 2009... Also, in order to make some publicity for my site Big Grin , you could try my tutorials: http://avenir.ro/create-cms-using-codeig...dmin-area/
Reply

#5
(06-08-2015, 02:02 AM)Avenirer Wrote: What @Diederik said. Especially the part with the 2009... Also, in order to make some publicity for my site Big Grin , you could try my tutorials: http://avenir.ro/create-cms-using-codeig...dmin-area/

Thanks for all reply Smile

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?
Reply

#6
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.
Reply

#7
Maybe we have not understood Big Grin
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?
Reply

#8
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.
Reply

#9
Yeah Smile Thanks for the support and reply.
Reply

#10
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';
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.