Welcome Guest, Not a member yet? Register   Sign In
How can i call parent method - Extending CI_Lang
#1

[eluser]Mauricio de Abreu Antunes[/eluser]
Hello,

I've created some methods in my MY_Lang.
One of these methods load translations files and i wanna put this method in MY_Lang.
This is my method:

Code:
/**
   * Carrega os arquivos de tradução
   * @access  public
   * @param  string $lang
   *    idioma
   * @return  void
   */
  public function _carrega_arquivos() {
   global $CFG;
   //Carrega os arquivos de tradução adicionais.  
   foreach ($this->arr_lang_files as $lang_file) {
    $this->load($lang_file, $CFG->item('language'));
   }
  }

My problems is in $this->load.
Any idea?
#2

[eluser]toopay[/eluser]
Any error occur by above script?

You should not grab $CFG like that. Its more appropriate to use something like :
Code:
$config =& get_config();
$this->load($lang_file, $config['language']);

Also, you actually dont have to passed the second parameter to fetch language config, the load method within Lang class will do that automatically if you dont passed the second argument.





Theme © iAndrew 2016 - Forum software by © MyBB