CI 2 ignores core folder. |
[eluser]dardar[/eluser]
I recently upgraded from 1.7.2. I've moved my MY_Profiler.php to /core/ folder, but it just ignores /application/core folder. If I move back this file to libraries, I'm getting error: Code: Fatal error: Call to undefined method CI_Profiler::ci_profiler() in C:\www\epg\application\libraries\MY_Profiler.php on line 13 My code looks like: Code: class MY_Profiler extends CI_Profiler { this 13 line: Code: parent::CI_Profiler($config);
[eluser]InsiteFX[/eluser]
Code: /* InsiteFX
[eluser]Matthieu Fauveau[/eluser]
[quote author="dardar" date="1301115034"]I recently upgraded from 1.7.2. I've moved my MY_Profiler.php to /core/ folder, but it just ignores /application/core folder. If I move back this file to libraries, I'm getting error: Code: Fatal error: Call to undefined method CI_Profiler::ci_profiler() in C:\www\epg\application\libraries\MY_Profiler.php on line 13 My code looks like: Code: class MY_Profiler extends CI_Profiler { this 13 line: Code: parent::CI_Profiler($config); Should be Code: parent::_construct($options);
[eluser]InsiteFX[/eluser]
And it should be placed into application/libraries not application/core InsiteFX
[eluser]dardar[/eluser]
@Matthieu Fauveau Thank you, it works. @InsiteFX I'm in a mess right now. Why not /core folder? As Codeigniter2 documentation states: Quote:For example, to extend the native Input class you'll create a file named application/core/MY_Input.php( http://ellislab.com/codeigniter/user-gui...asses.html ) I would like to follow the official rules, but am I wrong here? Or maybe there is a mistake in documentation?
[eluser]LuckyFella73[/eluser]
Quote:( http://ellislab.com/codeigniter/user-gui...asses.html ) You read the page dscribing how to extend "core classes" - which are found in "system/core". The Profiler class is not a CI "core-member" There is a simple rule: If you want to extend a CI class located in "system/core/" place your "MY_classextention" in "application/core/". The same principle with classes saved in "system/libraries/" ..
[eluser]blacklion[/eluser]
Further to this subject, I have been trying to replace the core Log class. The manual page at http://ellislab.com/codeigniter/user-gui...asses.html shows that Log is a core system file but going on the instructions from LuckyFella73, it is in fact located in the system/libraries folder, not system/core. However, I am still having trouble replacing this file into application/libraries. (Log.php) If I remove the system/libraries version, all is ok. I can't figure out why this is... I haven't yet tried extending it as it is so small, it's not worthwhile. Can anyone tell me what I am doing wrong? (I'm a newb!) Sorry for hijacking.... BL
[eluser]InsiteFX[/eluser]
1) If the library you are extending is in system/libraries then your extended version goes into application/libraries ! 2) If the library you are extending is in system/core then your extended version goes into application/core ! As LuckyFella73 stated above! InsiteFX
[eluser]blacklion[/eluser]
@InsiteFX: Thanks - I guess I wasn't clear enough - I was trying to ask 2 things; 1) The manual is (appears to be) wrong in that Log is not a core class - no biggie. 2) Replacing Log.php into application/libraries doesn't seem to work for me for some reason I can't figure. I'm using: class CI_Log { ... } But unless I remove the system/libraries/Log.php I can't get my version to work. Any ideas?! BL
[eluser]InsiteFX[/eluser]
Ya, that's an Error in the CodeIgniter User Guide, the log.php class is in system/libraries. Try this: not tested. Code: class Log extends CI_Log { InsiteFX |
Welcome Guest, Not a member yet? Register Sign In |