php - codeigniter add language flag in the end of url -
i`m using codeigniter 3.0.3 need add language flag in end of url
and on loading page need check this
// removing slash $url = rtrim($url, '/'); // checking if url $url = filter_var($url, filter_sanitize_url); // splitting $url on slashes $this->_url = explode('/', $url); // checking if exists language if(lang::check(end($this->_url))) unset($this->_url[count($this->_url) - 1]); and after need send $this->_url bootstrap , route this
also need create how lang class implementing database check if flag in database...
so how can this???
this url type client
http://www.example.com/controller/function/value1/value2/value3/en
and en flag of english converted url must be
http://www.example.com/controller/function/value1/value2/value3
and en must add in session after check key lang_key
function($value1,$value2,$value3,$lang=null){ if($lang){ $newdata = array( 'username' => 'johndoe', 'lang' => $lang ); $this->session->set_userdata($newdata); } redirect("controller/function/$value1/$value2/$value3", 'refresh'); }
Comments
Post a Comment