我目前有以下功能,但我想使用以下方法将其更改为“模板”,但我不确定实现目标的最佳方法是:
这背后的原因是因为我需要利用 append_metadata($this->load->view('fragments/wysiwyg', array(), TRUE))
我的product_get_details
Function 中的 admin 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, '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', array(), 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');
}