脚本宝典收集整理的这篇文章主要介绍了php – Codeigniter视图函数更改为$template,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这背后的原因是因为我需要在PRoduct_get_details函数中利用admin WYSIWYG片段apPEnd_Metadata($this-> load-> view(‘fragments / wysiwyg’,array(),TRUE)).
码:
public function ajax_product_get_details($product_id = NULL) { if(isset($_POST['id'])) { $product_id = $_POST['id']; } $table = SITE_REF.'_ps_products'; $data['product_details'] = $this->Ps_products_model->table_get_row($table,$product_id); $data['assoc_categories'] = $this->Ps_products_model->product_get_x_categories($product_id); $data['parent_categories'] = $this->Ps_products_model->categories_get_parent_list(); $data['folders'] = $this->file_folders_m->get_folders(); $table_man = SITE_REF.'_ps_products_manufacturers'; $data['manufacturers'] = $this->Ps_products_model->table_get_all($table_man,'name','asc'); $this->load->view('admin/ajax/admin_product_details',$data); }
指数功能:
public function index() { $this->template ->title($this->module_details['name']) ->append_js('jquery/jquery.ui.nestedSortable.js') ->append_js('jquery/jquery.stickyscroll.js') ->append_Metadata($this->load->view('fragments/wysiwyg',TRUE)) ->append_js('module::admin.js') ->append_css('module::admin.css') ->append_css('module::custom.css') ->set('pages',$this->page_m->get_page_tree()) ->set('folders',$this->file_folders_m->get_folders()) ->build('admin/index'); }
所以你只需要在admin_product_details视图中添加这一行:
$this->load->view('fragments/wysiwyg');
编辑
你为什么不简单地使用你的模板? :
public function ajax_product_get_details($product_id = NULL) { if(isset($_POST['id'])) { $product_id = $_POST['id']; } $table = SITE_REF.'_ps_products'; $data['product_details'] = $this->Ps_products_model->table_get_row($table,$product_id); $data['assoc_categories'] = $this->Ps_products_model->product_get_x_categories($product_id); $data['parent_categories'] = $this->Ps_products_model->categories_get_parent_list(); $data['folders'] = $this->file_folders_m->get_folders(); $table_man = SITE_REF.'_ps_products_manufacturers'; $data['manufacturers'] = $this->Ps_products_model->table_get_all($table_man,'asc'); $this->template ->title($this->module_details['name']) ->append_Metadata($this->load->view('fragments/wysiwyg',TRUE)) ->build('admin/ajax/admin_product_details',$data); }
以上是脚本宝典为你收集整理的php – Codeigniter视图函数更改为$template全部内容,希望文章能够帮你解决php – Codeigniter视图函数更改为$template所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。