Welcome Guest, Not a member yet? Register   Sign In
Controller file and class names...

This is an issue with CI that has bugged me for quite some time. So I've written a library named settings that manages my applications settings in the database. Now in my admin panel I'd logically like to have a controller named settings where the user can easily change my apps settings. Due to CI's goofy naming conventions I can't have a library and a controller named settings as it creates a collision due to them having the same class name. In a perfect world it would be great if CI had standardized naming conventions for example, model and helper filenames end with _model and _helper respectively. Why don't controllers? or libraries? Has anyone encountered this issue and come up with a solution? Maybe a modified codeigniter and\or router class in the core?

Thanks for reading

I don't think you're not allowed to name your controller Settings_controller. Afterwards you can change your routes file to map 'settings/whatever' to 'settings_controller/whatever'.

I agree, this is a bit of a hassle, but it should work.

In your specific case, why not call it prefs or admin or whatever?

This case was just an example, I've encountered it many times in the past with different scenarios. Excellent idea with the routes though I didn't think of that, I ended up using the code below and all is working well. Thanks for the idea!

$route['(:any)'] = '$1_controller';

Theme © iAndrew 2016 - Forum software by © MyBB