[eluser]PermanaJ[/eluser]
Thanks for the advice .. I just want to try all code igniter's feature ...
btw, I have try the hooks ...
Code:
function do_language() {
$CI =& get_instance();
$language_cookie = config_item('cookie_prefix').config_item('language_cookie');
$language = config_item('language');
if(isset($_COOKIE[$language_cookie])){
$CI->config->set_item('language',$_COOKIE[$language_cookie]);
$language = $_COOKIE[$language_cookie];
}
$path = '/';
$expire = time() + 604800;
setcookie($language_cookie, $language, $expire, $path);
$CI->lang->load(config_item('language_file'),config_item('language'));
}
It works when the hook point is 'post_controller_constructor', but when I try to try at hook point 'pre_controller' it result an error message :
Quote:Fatal error: Call to a member function set_item() on a non-object in D:\Project\PHP\myapp\application\hooks\myhooks.php on line 9
I need to set the language before the controller initialized because I load language file at controller ...