Welcome Guest, Not a member yet? Register   Sign In
Multilanguage Page
#1

[eluser]forzaferrari87[/eluser]
Hallo,

now I'm a little bit trained into CodeIgniter and want to my little website (http://bvb-fan.tk/en) migrate into this framework. certainly I have a question because of the multilanguage.

the thing is, what i am asking for. how can I get my website for multi language in Codeigniter? Currently I define this only by a $_GET variable in my Code and want to do this some professional now.

Has somebody a link for me or a hint how I can search at Google for this? Perhaps can somebody explain me how do the multi language at CodeIgniter.

Also I would like to search in this forum, but I can't see at the advanced search where I can search at the CodeIgniter part.
#2

[eluser]Tpojka[/eluser]
You have this documentation page about languages.
There is other multi-lang packages on github codeigniter wiki pages. Maybe, when see how it works, you could try this one.
#3

[eluser]forzaferrari87[/eluser]
The Plugin with the MCI-Codeigniter is a good way for a solution at my site, but one thing I'm asking me. In some tables there are country codes like 'de' and 'en'. The way what I'm asking me, how do I get the query that the database knows in which language wants the user for example a news.
#4

[eluser]InsiteFX[/eluser]
In your Controller

Code:
// is it an Ajax request?
    if ($this->input->is_ajax_request())
    {
        $lang_data = $this->input->get('some_data', TRUE);

        // query your database and get the language value.
    }
    else
    {
        // else its a normal request
    }
#5

[eluser]forzaferrari87[/eluser]
I don't understand why, but if I am using "$lang_data = $this->input->get($lang, TRUE);", then I get no output. On the line echo print_r($lang_data); I get 1 and not 0. That is for me a hint, that the value should be to see. If I am using "$lang_data = $lang" in my Controller, then I get an output.

If I understood correctly the Documentation for the Input Class, then you have no settings to make in the Config, so that value should be shown automaticly.

At my edit forms in my testing codeigniter I have no issues with $this->input->post() by the ID's. That as comparison.
#6

[eluser]InsiteFX[/eluser]
It is returning a Boolean TRUE/FALSE that's why your getting a 1, try doing a var_dump and see what you get.

#7

[eluser]forzaferrari87[/eluser]
I get a false output with var_dump.

Code:
class news extends CI_Controller {
    public $lang = null;
    
    public function __construct() {
        parent::__construct();
    }
    
    public function index($lang) {
        $lang_data = $this->input->get($lang, TRUE);
        print_r($lang_data);
        var_dump($lang_data);
        echo print_r($lang_data);
    }
    
    public function cat() {
        $something = $this->input->get('something', TRUE);
        echo $something;
        print_r($something);
        var_dump($something);
        echo print_r($something);
    }
}

That's my source code in the Controller to find out the right way for the get value.




Theme © iAndrew 2016 - Forum software by © MyBB