Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器+;Ion身份验证自定义页面模板错误_Php_Codeigniter_Authentication_Ion Auth - Fatal编程技术网

Php 代码点火器+;Ion身份验证自定义页面模板错误

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() :

我想使用模板来加载我的页眉、主要内容和页脚。这似乎是最佳实践,而不是必须在每个视图上加载页眉和页脚

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() : $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

感谢您的快速响应。成功了!谢谢你的快速回复。成功了!