Multiple languages website using CodeIgniter |
[eluser]Christophe28[/eluser]
Hello, I'm trying to create a multiple language website using CodeIgniter. The idea is to create a library with a map containing the language files. Now the library looks like this: Code: Class Languages { A language (like english.php) file looks like this: Code: <?php The controller: Code: // Set user language Code: <div id="welcome_box_left"> But in the view I would rather like instead of $lang['WELCOME_LEFT_BOX'] see $lang->welcome_left_box ... That would be much prettier :-) Does anybode know how I can do this in CodeIgniter using my library? Thx! Christophe
[eluser]treeface[/eluser]
Hi Christophe, Have you given the Language class a look? http://ellislab.com/codeigniter/user-gui...guage.html There's also a helper class available that lets you access your information: http://ellislab.com/codeigniter/user-gui...elper.html
[eluser]Christophe28[/eluser]
Hi, Thanks for the reply! I already got to manage it using the following function: Code: function parseArrayToObject($array) { But I'll take a look at the language class ;-) Best, Christophe
[eluser]danmontgomery[/eluser]
... Code: $array = array('foo' => 'bar'); http://php.net/manual/en/language.types....ggling.php
[eluser]Christophe28[/eluser]
Waw, didn't know that! Thanks for sharing! 1 line instead of 13 lines Christophe
|
Welcome Guest, Not a member yet? Register Sign In |