Welcome Guest, Not a member yet? Register   Sign In
Controller Sub-Folders?
#1

[eluser]Moon 111[/eluser]
My website has two languages so I was going to have an english sub-folder and a hebrew sub-folder inside my controller folder. Is this not allowed?

How should I do this instead?

Thanks,
- Moshe
#2

[eluser]Developer13[/eluser]
Well, unless I'm missing the reason why you'd have a separate controller for each language, the reason the language library exists is so you can replace your variables with $this->lang->line('item') calls... so this begs the question, why do you want to have separate controllers for the different languages?
#3

[eluser]Moon 111[/eluser]
I don't know... How would you do it? I couldn't really think of anything...
#4

[eluser]Moon 111[/eluser]
I'm not fimiliar with $this->lang->line(). How does it work? The user guide is very vague...
#5

[eluser]xwero[/eluser]
As D13 i'm asking myself if you are really planning on having different controllers for the two languages or if you just want to add the language to the url?

If you are planning to have different controllers a language subdirectory is a good idea and it's possible to do this? So i'm wondering what is the problem you have?

If you are planning to add the language to the url but use the same controllers you can use routing to 'hide' the language form been seen as a part of the filepath/controller/function url structure CI uses.
Code:
$route['\w{2}/(.+)'] = '$1';
This route checks if the first segment has 2 letters, a forward slash and at least one character behind the forward slash. So site.com/en/1 would be routed to a controller with the name 1.
There are some other solutions mentioned on the forum you can do a search for multi language site or something like that.

The lang->line method just gets the word/phrase with the key you add as the first parameter. Of course you need to load the language file where the key and word/phrase for the particular language is stored.
#6

[eluser]Moon 111[/eluser]
I get an error... One second I'll post it.




Theme © iAndrew 2016 - Forum software by © MyBB