loving the MY_Controller, But... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: loving the MY_Controller, But... (/showthread.php?tid=50517) |
loving the MY_Controller, But... - El Forum - 03-28-2012 [eluser]amosdesigns[/eluser] Hi all, I have watch and read several different tuts on setting a MY_Controller and a MY_Model. My questions in which folder should I place the MY_Public_Controller and MY_Backend_Controller for my App? I have been told in the Library folder and then I would need to add some autoload file in the config file. Or should I add it to the core folder?But I'm having it does not autoload the MY_Controller? Thanks for the help. Jerome Amosdesigns.net loving the MY_Controller, But... - El Forum - 03-28-2012 [eluser]InsiteFX[/eluser] They should be placed into the ,/application/core folder. Also you still need the auto because CI will only see the first main MY_ Here is how it goes: If the Class you are extending is in ./system/core then it goes into ./application/core If the Class you are extending is in the ./systm/libraries then it goes into ,/application/libraries loving the MY_Controller, But... - El Forum - 03-28-2012 [eluser]amosdesigns[/eluser] Thanks for the help. loving the MY_Controller, But... - El Forum - 03-30-2012 [eluser]kirkaracha[/eluser] You can also put both MY_Public_Controller and MY_Backend_Controller functions in the same MY_Controller.php file. Code: <?php if(!defined('BASEPATH')) exit('No direct script access allowed'); loving the MY_Controller, But... - El Forum - 03-30-2012 [eluser]InsiteFX[/eluser] That will break CI Styling Guide Lines loving the MY_Controller, But... - El Forum - 03-30-2012 [eluser]kirkaracha[/eluser] The Style Guide says "Use separate files for each class your add-on uses, unless the classes are closely related." These seem pretty closely related to me. loving the MY_Controller, But... - El Forum - 03-30-2012 [eluser]Aken[/eluser] The style guide is also mainly for released applications / libraries. If it's your application, you can do whatever you want with it. Unfortunately if you want to follow the "style guide" way of doing things, you still need to add some sort of autoload or extended loading class that will look for base controllers in the correct spot. |