![]() |
multilanguage database struct - 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: multilanguage database struct (/showthread.php?tid=27655) Pages:
1
2
|
multilanguage database struct - El Forum - 03-29-2010 [eluser]Isern Palaus[/eluser] No problem, it's a pleasure. Don't ask me why, but if you make this changes: - Rename the class to MY_Controller: Code: class Web extends MY_Controller { - Make the constructor PHP5 like: Code: function __construct() - Rename the file to MY_Controller.php - Extend MY_Controller in the Web controller (and change parent to parent::MY_Controller()). ... works! :-) Well, I can't promise but shows me a database error so recognises the MY_Controller one ;-). Whish it helps!! multilanguage database struct - El Forum - 03-29-2010 [eluser]siubie[/eluser] great this thing works ![]() another million thanks for you Isern ![]() multilanguage database struct - El Forum - 04-22-2011 [eluser]onuryasar[/eluser] guess this doesn't work "as is" in 2.0. what should be changed? multilanguage database struct - El Forum - 10-20-2012 [eluser]Unknown[/eluser] [quote author="Isern Palaus" date="1266406574"]Hello, I have a table called 'idioma' (language in spanish): Code: CREATE TABLE IF NOT EXISTS `idioma` ( nombre -> name codigo -> code locale -> locale imagen -> image orden -> order activo -> active fecha -> date I add entries like: Name = English, Code = EN, Locale = en_US, Image = en.jpg, Order = 1, Active = 1, Date = 2010-02-17. Then, to detect the language I personally use URI Language founded on the wiki for the detect the languages like .com/en, .com/es, .com/fr... and my BaseController (that I extend on every controller) looks like: Code: <?php And in the MY_Language.php helper: Code: function getLanguage() So I can access in every controller with $this->idioma. Then all my tables that contents multilingual content has this structure: news ---- idnews image user_id date news_description ---------------- idnews_description text news_idnews idioma_ididioma Then for every new you will add a text for every language. A query will look like: Code: public function get_new($idnews = 1, $ididioma = 1) And you will call it with get_news($new_id, $this->idioma). I wish it helps and sorry for my school English. Regards, Isern[/quote] Hello dear Isern! I read your tutorial on how to make a multi-language application, and some things i understand but there are some thing that i don`t. Unfortunately for me it is not clearly described, like what i should do before the tutorial? My example I have a CodeIniter application totally on english language now i want to make it 2 language. my DB structure: table called Main: id title_en description_en keywords_en category_en title_fr description_fr keywords_fr category_fr And i have content in this db structure. Like i told you my application is working now only in english language, i want to add 2 flags on the top of header to switch between 2 languages using database content?? From what i read on this forum you are a CodeIgniter pro and i hope you can explain me what steps i need to do from the beginning. |