2016-11-04 41 views
1

我是Codeigniter的新手。我爲表單創建了一個模板,並希望在視圖文件中解析它。它是解析,但它在頁面頂部迴響解析形式,而不是我想要的地方。我沒有使用整個頁面的模板。我想使用解析器渲染頁面的和平。 這裏是我的解析器:在視圖中解析模板codeigniter

<form action = {action}> 

<select name = {input_name}> 
    {options} 
     <option value = {val}>{name}</option> 
    {/options} 

</select> 

我叫使用此功能從我的view.php這個模板:

$this->parser->parse('form_templates/vehicle_category.php', $form_data); 

回答

0

我應該看看解析庫。解析函數有第三個參數,它告訴返回結果而不是回顯。更新的代碼是:

$this->parser->parse('form_templates/vehicle_category.php', $form_data, true); //true for return default is false