Welcome Guest, Not a member yet? Register   Sign In
route dose not work to sub folders
#11

Yes, don't alter anything in /system. It's completely unnecessary and will make upgrading a pain since you basically replace everything in /system, so you'd have to reimplement all of your custom changes each time you upgrade. You can extend the core and add new functionality, or override existing functions with your own.

See the docs for "extending core classes": http://www.codeigniter.com/user_guide/ge...core-class
Reply
#12

(This post was last modified: 04-08-2015, 02:01 PM by Mel9pr.)

(04-08-2015, 08:56 AM)Narf Wrote: You can have as many classes in as many subdirectories (although I wouldn't advise you to do that), but there's no way to make any of them a default controller.

Due to organization purposes I have all my controllers on sub folders (application/controllers/links/Links_controller.php... application/controllers/news/News_controller.php...... application/controllers/about_us/About_us_controller.php... and so on...) All is working OK using custom routes on routes.php. So my question is why you don't advise to do that? Is there something to be worry about it?
Reply
#13

Probably because it takes CI extra time to figure out if the requested controller is in a subdirectory, or a sub-sub directory, etc. All it knows is the requested route is 'something/something_else/another_thing'. It doesn't know whether "something" is a controller, or a directory, so it has to look until it finds it. The more layers of subdirectories the more it has to check.
Reply
#14

(04-08-2015, 02:08 PM)CroNiX Wrote: Probably because it takes CI extra time to figure out if the requested controller is in a subdirectory, or a sub-sub directory, etc. All it knows is the requested route is 'something/something_else/another_thing'. It doesn't know whether "something" is a controller, or a directory, so it has to look until it finds it. The more layers of subdirectories the more it has to check.

So basically it will take less time for CI to find CI.com/about-us/page/1 with one-to-one relationship between a URL string and its corresponding controller class/method than re-routing with $route['about-us/(:any)'] = "about_us/page/index/$1"; having the controller in a sub folder?
Reply
#15

(04-08-2015, 01:57 PM)Mel9pr Wrote:
(04-08-2015, 08:56 AM)Narf Wrote: You can have as many classes in as many subdirectories (although I wouldn't advise you to do that), but there's no way to make any of them a default controller.

Due to organization purposes I have all my controllers on sub folders (application/controllers/links/Links_controller.php... application/controllers/news/News_controller.php...... application/controllers/about_us/About_us_controller.php... and so on...) All is working OK using custom routes on routes.php. So my question is why you don't advise to do that? Is there something to be worry about it?

I was talking about nested directory levels (as in dir1/dir2/dir3/dir4/file.php), because each nesting level degrades performance.

Your examples don't go that far, but if they're real ... you're not organizing, you're only creating redundancy. And even if you are organizing, that's not a practical benefit.
Reply
#16

Thank you all
But I am still convinced that this is a bad thing in codeigniter , because no one put its classes in the controller directly
Reply
#17

ln -s? Anyone?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB