无法加载请求的语言文件:Codeigniter HMVC
Unable to load the requested language file: Codeigniter HMVC
我在 codeigniter 中使用模块化扩展 - HMCV。在我的模块文件夹中,我有一个名为 template
、customer
、common
的模块。每个文件夹都有以下文件夹 controllers
、models
、views
和 language
,在 language
中我有 english
文件夹。
我的Template.php如下
<?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
这是我调用此模板将使用的模块的地方。我正在调用 customer/sign_in
和 customer/sign_up
在每个页面中加载 sign_in 和 sign_up 模态,因为我有 sign_in 和 sign_up 链接header(导航栏).
我的Customer.php如下
<?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
控制器扩展了 Frontend_controller,在 core/MY_Controller
中扩展了 MX_Controller
当我 运行 customer/forgot_password 我得到 无法加载请求的语言文件:language/english/sign_in_lang.php 错误信息
注意: sign_in_lang.php
在 customer/language/english
中 forgot_password_lang.php
注意:在我的config.php
中我有$config['language'] = 'english';
像这样加载您的 lang
文件..
$this->lang->load('customer/forgot_password');
和
$this->lang->load('customer/sign_in');
我在 codeigniter 中使用模块化扩展 - HMCV。在我的模块文件夹中,我有一个名为 template
、customer
、common
的模块。每个文件夹都有以下文件夹 controllers
、models
、views
和 language
,在 language
中我有 english
文件夹。
我的Template.php如下
<?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
这是我调用此模板将使用的模块的地方。我正在调用 customer/sign_in
和 customer/sign_up
在每个页面中加载 sign_in 和 sign_up 模态,因为我有 sign_in 和 sign_up 链接header(导航栏).
我的Customer.php如下
<?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
控制器扩展了 Frontend_controller,在 core/MY_Controller
当我 运行 customer/forgot_password 我得到 无法加载请求的语言文件:language/english/sign_in_lang.php 错误信息
注意: sign_in_lang.php
在 customer/language/english
中 forgot_password_lang.php
注意:在我的config.php
中我有$config['language'] = 'english';
像这样加载您的 lang
文件..
$this->lang->load('customer/forgot_password');
和
$this->lang->load('customer/sign_in');