我正在使用模块化扩展 - 在codeigniter中使用HMCV。在我的modules文件夹中,我有一个名为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链接。
我的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';
答案 0 :(得分:0)
像这样加载 contexts: [admin]
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Application\Sonata\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)
service:
user_manager: sonata.user.orm.user_manager # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb)
sonata_user:
admin:
user:
class: Ap\UserBundle\Admin\Model\UserAdmin
group:
class: Ap\UserBundle\Admin\Model\GroupAdmin
个文件..
lang
和
$this->lang->load('customer/forgot_password');