codeignitercodeigniter-hmvc

Unable to load the requested language file: Codeigniter HMVC


I am using modular extensions - HMCV in codeigniter. Inside my modules folder I have a module named template, customer, common. Each has the following folders controllers, models, views and language and inside the language I have english folder.

My Template.php is as follows

   <?php
   defined('BASEPATH') OR exit('No direct script access allowed');

   class Template extends Frontend_controller {

public function __construct(){

    parent::__construct();
}

public function informational_pages($data){

    $header['text_title'] = $data['text_title'];
    $header['meta_description'] = $data['meta_description'];
    $header['meta_robots'] = $data['meta_robots'];
    $header['meta_keywords'] = $data['meta_keywords'];
    $header['active'] = $data['active'];

    $data['header'] = Modules::run('common/load_header', $header);
    $data['sign_in'] = Modules::run('customer/sign_in');
    $data['sign_up'] = Modules::run('customer/sign_up');
    $data['reviews'] = Modules::run('common/load_reviews');     
    $data['side_bar_widgets'] =    Modules::run('common/load_side_bar_widgets');
    $data['footer'] = Modules::run('common/load_footer');

    $this->load->view('informational_pages', $data);

     }//end method informational_pages

 }//end class

This is where I am calling the modules that will be used by this template. I am calling the customer/sign_inand customer/sign_up to load the sign_in and sign_up modals in every page since I have sign_in and and sign_up links at the header(navbar).

My Customer.php is as follows

   <?php
  defined('BASEPATH') OR exit('No direct script access allowed');

 class Customer extends Frontend_controller {

public function __construct(){

parent::__construct();

    $this->load->model('customer_model');
    $this->load->library('form_validation');

 }

 public function forgot_password(){

       $this->lang->load('forgot_password', 'english');

        $view_data['text_heading'] = $this->lang->line('text_heading');
        $view_data['entry_email'] = $this->lang->line('entry_email');
        $view_data['button_submit'] = $this->lang->line('button_submit');
        $view_data['action'] = base_url().'customer/forgot_password';
        $loading['id_loading'] = $this->lang->line('id_loading');
        $view_data['loading'] = Modules::run('/common/load_loading_gif', $loading);

        $data['text_title'] = $this->lang->line('text_title');
        $data['meta_description'] = $this->lang->line('meta_description');
        $data['meta_robots'] = $this->lang->line('meta_robots');
        $data['meta_keywords'] = $this->lang->line('meta_keywords');
        $data['active'] = '';
        $data['view_file'] = 'forgot_password';
        $data['view_data'] = $view_data;
        $data['module'] = 'customer';
        echo Modules::run('template/informational_pages', $data);

 }//end method forgot_password

    public function sign_in(){

       $this->lang->load('sign_in', 'english');

        $data['text_sign_in']   = $this->lang->line('text_sign_in');
        $data['text_remember_me'] = $this->lang->line('text_remember_me');
        $data['text_sign_up_here']  = $this->lang->line('text_sign_up_here');
        $data['text_forgot_password'] = $this->lang->line('text_forgot_password');
        $data['entry_email'] = $this->lang->line('entry_email');
        $data['entry_password'] = $this->lang->line('entry_password');
        $data['button_sign_in'] = $this->lang->line('button_sign_in');
        $data['action'] = base_url().'customer/sign_in';
        $loading['id_loading'] = $this->lang->line('id_loading');

        $data['loading'] = Modules::run('/common/load_loading_gif', $loading);

        $this->load->view('sign_in', $data);


     }//end method sign_in


  }//end class

The controllers extend Frontend_controller which extends MX_Controller in core/MY_Controller

When I run customer/forgot_password I am getting Unable to load the requested language file: language/english/sign_in_lang.php error message

Note: The sign_in_lang.php is in customer/language/english so as is the forgot_password_lang.php

Note: In my config.php I have $config['language'] = 'english';


Solution

  • Load your lang files like this..

    $this->lang->load('customer/forgot_password');
    

    And

    $this->lang->load('customer/sign_in');