Web site with 2 Languages |
[eluser]invision[/eluser]
Hi, I've followed this brilliant Wiki guide on using Multiple Languages with CodeIgniter and can now visit www.site.com/en/ and www.site.com/es/ and get the same page loading. Brilliant ![]() However, I now have some questions which I'd loooove to get an answer for. 1) How do I load a different navigation bar (a simple <div></div>) based on the current language (en/es/etc...) ? So it would load different language nav bar depending on the language the user chooses. and 2) How do I retrieve different data (different columns) from my database based on the current language? Would this require just loading a different set of methods from my Model/Controller? Many thanks for any guidance with this.
[eluser]umefarooq[/eluser]
you have to check which one is active language user has selected then you have to get data from database according to that language. database which i have design for one of my project is like this Code: database columns a little tweak in MY_lang trough which can check which one is active lang in your controllers Code: before cunstractor
[eluser]invision[/eluser]
Wow. Thanks for the detailed reply. I'm away from my computer right now but will try this as soon as I get home. Stay tuned ![]()
[eluser]invision[/eluser]
Ignore the previous message here ![]() When I put the following into my Controller: Code: $lang = $this->lang->active_lang; I'm guessing that's not right. Do I have to declare a particular 'segment' to choose from as it's currently choosing the controller name. Here's a snippet of MY_language for reference just in case I've made a mistake. Code: ... Many thanks for your help.
[eluser]umefarooq[/eluser]
which version of CI you are using i have tried this library with CI2.0 i have face one problem with this library that your segment 1 should be en or es but it always getting controller name. if you are using Code: $this->uri->segment(1); you are using this library with CI 1.7 let me try in that let see.
[eluser]invision[/eluser]
Many thanks for the speedy reply. I'm a bit stupid. I actually commented out the language part of my config file which meant it wouldn't pick up the 'en' part. D'oh ![]() Thanks again for all your help. I'll be back if I need any more ![]()
[eluser]mariuskmc[/eluser]
I have a problem with implementation of Multiple Languages with CodeIgniter I followed all the instructions and modifications, and I'm stuck I have the following situation In config Code: $config['language'] = 'romana'; In route Code: //route example: http://domain.tld/en/controller => http://domain.tld/controller if i set $config['lang_ignore'] = 'xx' to $config['lang_ignore'] = 'ro' i will have only English link with this link http://localhost/site/encontroller if I let $config['lang_ignore'] = 'xx' i will have both links but with this link http://localhost/site/roro/contreller/function http://localhost/site/enro/contreller/function where I'm wrong? Thanks And another question How much affect my urisegments, because now I have http://localhost/site/controller/function/variable and will be transformed like http://localhost/site/en/controller/function/variable Thanks again ![]()
[eluser]mariuskmc[/eluser]
I found the solution by changing AUTO to PATH_INFO in $config['uri_protocol'] I still have problems with pagination... because don't work how can I make it work? |
Welcome Guest, Not a member yet? Register Sign In |