function create()
{
$data['headline'] =" ";
$this->load->module('site_security');
$this->site_security->_make_sure_is_admin();
$update_id = $this->uri->segment(3);
if(!is_numeric($update_id))
{
$data['headline'] = "Add New Product";
//$data['headline'] = print_r($update_id)."if";
}
else
{
$data['headine'] = "Update Product Details";
//$data['headline'] = print_r($update_id)."else";
}
$data['view_module'] = "store_products"; //passing module name
$data['view_file'] = "create"; //passing method name
$this->load->module('templates'); // loads the template module
$this->templates->admin($data); //calls the template controller method admin which loads the admin view
}
我正在将标题文本通过以在视图中更改标题,具体取决于URL中第三个第三部分的内容。第一个IF语句将标题完美设置,但它不会介入其他语句,并且给我错误的错误是因为$标题在视图中不确定。奇怪的是,如果我使用注释的print_r语句,一切都可以完美,它将在视图中显示。
我认为必须是行$ data ['Headine'] ="更新产品详细信息";在其他方面,但我不知道为什么。
在您的其他语句中,
else
{
$data['headine'] = "Update Product Details";
}
您在这里有错字。将headine
更改为headline
。