这是我在codeignitor中的管理员登录部分的控制器文件和视图文件。所有帮助文件都存在于前端的根文件夹\system\helpers 中,没关系,但在管理部分显示以下错误
致命错误:在第 4 行调用 D:\wamp\www\CodeIgniter\application\views\admin\catalog\catalog_view.php 中的未定义函数 form()
我认为我们必须改变一些东西或其他东西???
D:\wamp\www\CodeIgniter\application\controllers\admin\catalog.php
<?php
/**
* Admin Catalog Controller
*/
class Catalog extends CI_Controller
{
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->view('admin/templates/header');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->load->database();
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required|valid_email');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('admin/catalog/catalog_view');
}
else
{
$this->form1_model->admin_login();
$this->load->view('admin/catalog/home_view');
}
$this->load->view('admin/templates/footer');
//$html_string = $this->load->view('admin/catalog/catalog_view');
}
}
D:\wamp\www\CodeIgniter\application\views\admin\catalog\catalog_view.php
<?php if (!defined('BASEPATH')) exit(__('No direct script access allowed')); ?>
<div class="light_blue_back" align="center">
<div class="adminbox">
**<?php echo form('adminform'); ?>**
<fieldset>
<legend><b>Admin Login</b></legend>
<dl>
<dt>
<label for="street_address1"> <span class="req">*</span>Email</label>
</dt>
<dd>
<input type="text" name="email" id="email" value=""/>
</dd>
</dl>
<dl>
<dt>
<label for="street_address2">Password</label>
</dt>
<dd>
<input type="password" name="password" id="password" value=""/>
</dd>
</dl>
<dl>
<dt>
</dt>
<dd>
<input type="submit" value="Submit" name="reg_sub" id="reg_sub"/>
<input type="reset" name="reg_reset" id="reg_reset" value="Reset" />
</dd>
</dl>
</fieldset>
</form>
</div>
</div>