Php 代码点火器+;Ion身份验证自定义页面模板错误
我想使用模板来加载我的页眉、主要内容和页脚。这似乎是最佳实践,而不是必须在每个视图上加载页眉和页脚 Auth.php控制器:Php 代码点火器+;Ion身份验证自定义页面模板错误,php,codeigniter,authentication,ion-auth,Php,Codeigniter,Authentication,Ion Auth,我想使用模板来加载我的页眉、主要内容和页脚。这似乎是最佳实践,而不是必须在每个视图上加载页眉和页脚 Auth.php控制器: else { //the user is not logging in so display the login page //set the flash data error message if there is one $this->data['message'] = (validation_errors()) ? validation_errors() :
else
{
//the user is not logging in so display the login page
//set the flash data error message if there is one
$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
$this->data['identity'] = array('name' => 'identity',
'id' => 'identity',
'type' => 'text',
'value' => $this->form_validation->set_value('identity'),
);
$this->data['password'] = array('name' => 'password',
'id' => 'password',
'type' => 'password',
);
//$this->_render_page('auth/login', $this->data);
$data['main_content'] = './auth/login';
$this->load->view('./includes/template', $data);
}
如果我注释掉_render_页面行并用另外两行替换它,我会收到未定义的变量错误,这是非常有意义的。如何使用我的设置传递$message、$identity和$password变量?仅供参考,我的模板如下所示:
<?php $this->load->view('includes/header'); ?>
<?php $this->load->view($main_content); ?>
<?php $this->load->view('includes/footer'); ?>
我应该改为编辑_render_page函数吗?感谢您提供的帮助。您需要传递$this->data,而不是$data您需要传递$this->data,而不是$data感谢您的快速响应。成功了!谢谢你的快速回复。成功了!