[eluser]zzzteph[/eluser]
Hello everyone. I'm writing a Hook which will select user language by the IP. I think the hook will be really fine to manage with it.So, I enabled Hooks in config.php. After that I put file language.php in the hooks folder (application/hooks).
Wrote the ini in config/hooks.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| http://ellislab.com/codeigniter/user-guide/general/hooks.html
|
*/
/* End of file hooks.php */
/* Location: ./application/config/hooks.php */
$hook['pre_controller']= array(
'class' => 'Language',
'function' => 'setlng',
'filename' => 'language.php',
'filepath' => 'hooks',
'params' => array()
);
And the language.php is
Code:
<?php
class Language {
function setlng(){
echo "I'll change some language";
}
}
I also try to do something like
Code:
<?php
class Language {
private $CI;
function __construct()
{
$this->CI = get_instance();
}
function setlng()
{
echo "Language change";
}
}
But all the time I got Error:500, what do I do wrong?