![]() |
Load Language from within an own Library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Load Language from within an own Library (/showthread.php?tid=24143) |
Load Language from within an own Library - El Forum - 11-01-2009 [eluser]codeworxx[/eluser] Hey Guys, i have created my own Language File and my own Class in the application/libaries Folder. The Language is defined in the Configuration File and Autoloaded! I have access to the File through the Views - there's no Problem, but when i try to access the Language File through my Libaries Class, i get an Error!! How to fix that? In my own Library Class i have to define a Standard Message - and this one depends on the Language, so i need access to the File. Hope everyone understands what i mean??? Greetings from Germany, Sascha Load Language from within an own Library - El Forum - 11-01-2009 [eluser]pistolPete[/eluser] Please post the code of the library. Which error do you get? Load Language from within an own Library - El Forum - 11-02-2009 [eluser]codeworxx[/eluser] Okay, that's the code of the Library: Code: class Displayerror An this is the Error: Quote:A PHP Error was encountered Line 19 is that line: Code: if( empty( $message ) ) $message = $this->lang->line( 'error_undefined' ); Thanks, Sascha Load Language from within an own Library - El Forum - 11-02-2009 [eluser]cahva[/eluser] If thats the whole code, yoy forgot to use get_instance() so that you can use CI libraries. This can be found in the user guide For example: Code: class Displayerror Load Language from within an own Library - El Forum - 11-02-2009 [eluser]codeworxx[/eluser] oh man... thank you so much... Think it was toooo late yesterday. Have used get_instance 2-3 Times and just forgotten. Thanks, Sascha |