CodeIgniter Forums
Problem extending CI_Lang in CI 2.0 with modular seperation - 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: Problem extending CI_Lang in CI 2.0 with modular seperation (/showthread.php?tid=33263)



Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 08-20-2010

[eluser]JoostV[/eluser]
Hi all,

I'm porting my app to CI 2.0, and ran into a problem.

I cannot seem to succesfully extend CI_Lang: the extension clas does not load. I am using modular seperation, (version 1.1, which should be CI 2.0 compatible)

I tried:
- MX_Lang extends CI_Lang
- MX_Language extends CI_Lang
- MY_Lang extends CI_Lang
- MY_Language extends CI_Lang

How can I extend CI_Lang, so that it automatically loads? I this for multiple language support.

EDIT I also tried MY_Lang extends MX_Lang :-S


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 08-20-2010

[eluser]WanWizard[/eluser]
It should be
Code:
class MY_Lang extends CI_Lang
or
Code:
class MY_Lang extends MX_Lang
(never used ModSep).

Don't forget Lang is a core library, so your extension has to go in application/core, not in application/libraries.


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 08-20-2010

[eluser]JoostV[/eluser]
Aahh... the core folder...
Thanks!


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 11-23-2010

[eluser]N'hono[/eluser]
Hi !
I tried the same thing but it doesn't work. I have to delete(or rename) the original Lang.php file if I want my application/core/Lang.php file to be read.
What do i do wrong ?
Arnaud


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 11-23-2010

[eluser]WanWizard[/eluser]
No, you don't have to delete anything.

Which CI version? For CI 1.7.2, it should be called MY_Language and placed in application/libraries, for CI 2.0 it should be called MY_Lang, and it has go to in applications/core.

If you've done that right, whats your definition of "it doesn't work"? Error messages? Unexpected behaviour? What have to tried to test and debug it?


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 11-23-2010

[eluser]N'hono[/eluser]
I use CI 2.0 and I would like to replacing the original CI_Lang class.

So I place the new Lang.php in my application/core folder. I turned on the log to see the debug messages. I only see the the original message in the log file.

But, with your advices, I rename the file MY_Lang.php, I extend the class instead of replace it and now it's working !

I thought i tried something like this before to post...

Thank you very much !!!!!!!!


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 11-23-2010

[eluser]WanWizard[/eluser]
Your welcome.

Remember that core extensions always start with MY_ (unless you change this default prefix in the config).


Problem extending CI_Lang in CI 2.0 with modular seperation - El Forum - 11-25-2010

[eluser]JoostV[/eluser]
Also, MY_Config, MY_Controller, MY_Lang, MY_Loader, MY_Router all go in your application/core folder. Non-core library extensions, like MY_Email go in application/libraries folder.