Welcome Guest, Not a member yet? Register   Sign In
Unable to load the requested language file - In extended controller
#1

I am new to codeigniter and I'm having trouble when extending a controller with this error message:
Quote:Unable to load the requested language file 'users' for current language 'english' AND for fallback to 'English'.

The code:
Code:
class Settings extends Admin_Controller {
   private $siteSettings;

   public function __construct() {
      parent::__construct();

      $this->auth->restrict($this->permissionView);

      $this->lang->load('users');
      $this->load->model('roles/role_model');

       $this->siteSettings = $this->settings_lib->find_all();
       if ($this->siteSettings['auth.password_show_labels'] == 1) {
           Assets::add_module_js('users', 'password_strength.js');
           Assets::add_module_js('users', 'jquery.strength.js');
       }

       Template::set_block('sub_nav', 'users/settings/_sub_nav');
   }
[...]
}

The second class
Code:
require_once(APPPATH. '/modules/users/controllers/Settings.php');

class Content extends Settings {

   public function __construct(){
       parent::__construct();

       $this->auth->restrict($this->permissionView);
       $this->load->model('funcionario/funcionario_model');
       $this->lang->load('funcionario');

       Assets::add_css('flick/jquery-ui-1.8.13.custom.css');
       Assets::add_js('jquery-ui-1.8.13.min.js');
       $this->form_validation->set_error_delimiters("<span class='error'>", "</span>");

       Template::set_block('sub_nav', 'content/_sub_nav');

       Assets::add_module_js('funcionario', 'funcionario.js');
   }
[...]
}

I believe the error is because the system is looking for the language file ($this->lang->load('users')) in the funcionario module directory (Content class is in funcionario/controllers) instead of looking in the users module directory (Settings class is in users/controllers).
The folder structure is comes from CI Bonfire. Codeigniter version: 3

[Image: GE8SF.png]
Reply
#2

Try getting the CI super object.

$CI =& get_instance();
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(01-22-2016, 04:12 AM)InsiteFX Wrote: Try getting the CI super object.

$CI =& get_instance();

The controller is the super-object.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB