CI ecommerce |
[eluser]ashabi[/eluser]
So the project is well on the way. Things are going much better than anticipated. But I am running into a problem with the multilanguage. I have 2 languages: hebrew and english. English is the default. Since they are completely different languages (right to left, left to right) I figured I need 2 different sets of templates. So I have the english views sitting directly under the views folder and the arabic is views/heb/ folder. I also have to allow the ability for multiple currencies. Meaning English site is just in dollars but the hebrew site can be in dollars or the hebrew currency. The user on the home page picks which site he goes to. Can anybody help me organize all this? I am so confused. Should I be using sessions or urls like www.mydomain.com/he or www.mydomain.com/en Thanks.
[eluser]tomcode[/eluser]
I use URL's and session, session's only for convenience, in case of someone coming back. I do : 1. have URL's set up : http://example.com/lang/controller/method where lang is a two letter token (ISO 639.1 notation, en, fr, de) the routes : Code: // one set for every controller 2. I rename my languages accordingly : english -> en french -> fr ... etc. 3. I organize my templates under the view folder accordingly, a template folder for common views with subfolders for each language 4. If the site's index is called without a language token : a. I look for a session language b. then I look for a browser language c. If I can't have a match with the site's language I use the site's default language d. I set the language in the session and redirect to the found language The code in MY_Controller : Code: class MY_Controller extends Controller { The MY_User_agent.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Edit : Forgot, have a config item, too : Code: /*
[eluser]ashabi[/eluser]
thanks but i don't know what i did wrong. its not working for me. just to clarify. i loaded My_Controller in the library as well as My_User_Agent. Right?
[eluser]Total Shop UK[/eluser]
To save you some time try setting up this eCommerce app. http://codeigniter.com/wiki/Total_Shop_UK/
[eluser]tomcode[/eluser]
Quote:... its not working for me??? You do not need to load MY_Controller (not My_Controller) and MY_User_agent (not My_User_Agent). The MY_ prefix triggers CI to autoload and extend the core classes, see the User Guide, Extending Native Libraries
[eluser]ashabi[/eluser]
tomcode - sorry I did that correctly, i just wanted to make it clear. But my home page works ok but the links don't work now, and also when i try http://mydomain.com/en/ or http://mydomain.com/he is there something missing on the htaccess? totalshopuk - looks great. but its missing the internationalization and the localization that I desparetly need. but i will definately take a more in depth look at it.
[eluser]tomcode[/eluser]
ashabi, my solution works only with controllers which have a _remap() function.
[eluser]tomcode[/eluser]
The _remap() function in a controller catches all incoming requests, all other methodes are ignored, so what You can do : Code: // put this method in Your Controllers
[eluser]Bart v B[/eluser]
@tomcode Code: <?php must be: Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |