Rename controller |
Hi!
I'm new in oop and ci and there is a point, where i have no idea for a nice solution: My first project should be available in different languages. But how can i bring the nice URIs to an other language? I think routes are my friends, but is this the way of choice? I have in german Code: /karte/erstellen This should in english Code: /card/create As i told, i'm new. So what is the finest way to rename my controllers and methods for a new language? Thanks
I was just trying to do a tutorial about multilanguage site subject (http://avenir.ro/create-cms-using-codeig...deigniter/), and I got to this part that you are asking about. What I was thinking is something in the lines of this:
I thought of doing the language things inside the routes.php. First of all, I associated "controllers" and "methods" of other languages to the controllers and methods we have defined (this one is done manually, unless you think of another method): PHP Code: $controllers_methods = array( Then, I just return a callback function when someone asks for a controller and method in a particular language: PHP Code: $route['^(\w{2})/(.*)'] = function($language, $link) use ($controllers_methods) So, in the end the router.php would look something like this: PHP Code: <?php What do you think? Any inputs? Website: http://avenir.ro
HI! I will just say thank you at the moment. I have some other issues with my project, so i work on this part a little bit later. I will comḿent what i did then and how it works.
|
Welcome Guest, Not a member yet? Register Sign In |