CodeIgniter Forums
Extending library different behavior and problems - 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: Extending library different behavior and problems (/showthread.php?tid=58168)



Extending library different behavior and problems - El Forum - 05-22-2013

[eluser]minttux[/eluser]
hi
i need to generate log files with special file name so i extended Log.php and create MYO_Log.php inside library in application folder and it worked correctly but it's very clean if i put every extended class or files inside core folder in application
but problem is here
the problem is MYO_log.php has different behavior when i put it in each core or libraries folder

when i put it in libraries it works instead of default Log.php (inside system folder) but when i put in core it doesn't work until i call log functions

is this a bug ?


Extending library different behavior and problems - El Forum - 05-22-2013

[eluser]TheFuzzy0ne[/eluser]
That should be in the ./application/core directory. The prefix by default is MY_ not MYO_. Have you changed it in your config file?

It would help if you could post the code for your library and also show us how you're loading it, although it should be loading itself automatically.


Extending library different behavior and problems - El Forum - 05-24-2013

[eluser]minttux[/eluser]
Sorry for late answer
i should made example for explain better this problem and now i made it
i extended log.php library
execute it and compare result when you put MYO_log.php in core and libraries
and yes because i separate my files with my prefix so for overwrite codeigniter files i used MYO_ prefix that is short of MY Overwrite and i set in config files

make sure log folder permission is 777
i use log_message('error', 'my own log'); in welcome.php controller to produce my own log so run the script one time when you put MYO_log.php in core and one time when you put in libraries

and you will see when it placed in libraries worked but in core doesn't work and load default log.php inside system folder

i put application folder also i have total project if you don't want replace with your own application folder
but you should download here https://docs.google.com/file/d/0B6rI2pr0PoLFbExrQzhId2NCdEU/edit?usp=sharing

Thanks



Extending library different behavior and problems - El Forum - 05-24-2013

[eluser]minttux[/eluser]
also you have great and useful website http://www.phptherightway.com Wink


Extending library different behavior and problems - El Forum - 05-24-2013

[eluser]TheFuzzy0ne[/eluser]
I actually though the log library was part of the core, and should therefore reside in the ./system/core directory, but it doesn't, so what you're describing is the expected behaviour.

I don' think this is a bug, since it works as intended, although I think the log class would be better off being in the core.

I wish I could take the credit for www.phptherightway.com. It's a site set up by several people I have a lot of respect for, and I've also found it extremely useful. I guess it's their effort to help standardise PHP, a bit like what W3C has done with (X)HTML. I'm glad you found it useful.