Welcome Guest, Not a member yet? Register   Sign In
Multiple languages web problems
#1

[eluser]Unknown[/eluser]
Hello forum, first of all, excure my english

here is my problem:



My web is multilanguaje ES (spanish) EN (english), ES by default

the web languaje is in a session var call 'idioma'

every navigation step in the web is ina session var call 'url'

so if i change my languaje session i could reload the same page

to change the languaje i change my session var from for exmaple ES to EN or EN to ES

and redirect to 'url' session var


This system works OK if my url have no parameters

the problem is for example when my url is like 'controller/function/param1'

the redirection dont work and insted of redirect me to my session var url = 'controller/function/param1'

the redirection is to an unkown direction like 'controller/funtion/fonts/sifr.swf'

why dont rtedirect me to the session var 'url' who have the actual web position and add to the url this parameters??

please could you help me, is for a job work


here some code


Code:
class Welcome extends Controller
{

        // -----------------------------------------------------------

    function Welcome()
    {
        parent::Controller();
        if($this->session->userdata('idioma') == "")
        {            
            session_start();
            $this->session->set_userdata('idioma','ES');
        }        
        
                                    
    }

        // -----------------------------------------------------------

    function cambiar_idioma()
    {
        
        if($this->session->userdata('idioma') == 'ES')
        {
            $this->session->set_userdata('idioma','EN');
        }
        else
        {
            $this->session->set_userdata('idioma','ES');
        }
                                        
        redirect($this->session->userdata('url'),'refresh');

    }

        // -----------------------------------------------------------
    
    function home()
    {    
        // URL
        $this->session->set_userdata('url', uri_string());
        
        // TEMPLATES    
        $data['template']['cabecera'] = "cabecera";
        $data['template']['colIzquierda'] = "colIzquierda";
        $data['template']['colCentral'] = "colCentral";
        $data['template']['colDerecha'] = "colDerecha";
        $data['template']['pie'] = "pie_".$this->session->userdata('idioma');

        // VARIABLES
        $data['css'] = "baseHome.css";
        $data['titulo'] = "Bienvenido";
        
        // PAGINA        
        $this->load->vars($data);
        $this->load->view('template');
    }    

    // -----------------------------------------------------------


when my url is like welcome/home ... when a link call welcome/cambiar_idioma all its ok

but

when my url i slike welcome/home/10 ... when a link call welcome/cambiar_idioma ... the session var 'url' is changed in my Welcome constructor and i dont know why ????




Theme © iAndrew 2016 - Forum software by © MyBB