• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help in redirect page standing

#1
[eluser]java[/eluser]
Hi everybody! I have made 2 set of language, my problem is when i want to change the current language into another language : it's always back to main page (because i have created a controller named lang and this is its code:
Code:
class Lang extends Controller {
    
    function Lang()
    {
        parent::Controller();
    }
    
    function index()
    {
        $cur_lang = $this->uri->segment(3);
        if ($cur_lang=='english' OR $cur_lang=='vietnamese'){
            $cookie = array(
                   'name'   => 'lang',
                   'value'  => $cur_lang,
                   'expire' => '86500',
                   'domain' => $this->config->item('cookie_domain'),
                   'path'   => '/',
                   'prefix' => '',
               );
            set_cookie($cookie);
            redirect('/home', 'refresh');
        }else{
            redirect('/home', 'refresh');
        }
    }
}
), i want when i standing on the current page(not main page) and change language, it's still stand on that page and not back to main page. How can i solve this problem? Thanks for any response.

#2
[eluser]Michael Wales[/eluser]
Store a cookie/session variable for every page they visit (except for pages within the Lang controller). Update that cookie/session with the entire URI (controller/method/params).

Then just change you redirects there to pull the value of that cookie/session down for their first param.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.