如果我将带有数组参数的form_helper放入我的智能模板中,这是否可行。
这是我控制器的方法:
function input($pIntBookId = 0) {
$this->load->model('m_books');
if($this->input->post('mysubmit')){
if($this->input->post('id')){
$this->m_books->entryUpdate();
}else{
$this->m_books->entryInsert();
}
}
$arrData = $this->m_books->general();
if((int)$pIntBookId>0){
$strQuery = $this->m_books->getId($pIntBookId);
$arrData['idxFid']['value'] = $strQuery['book_id'];
$arrData['idxFtitle']['value'] = $strQuery['book_nm'];
$arrData['idxFauthor']['value'] = $strQuery['book_aut'];
$arrData['idxFpublisher']['value'] = $strQuery['book_pub'];
$arrData['idxFyear']['value'] = $strQuery['book_year'];
if($strQuery['book_st']=='yes'){
$arrData['idxFavailable']['checked'] = true;
}else{
$arrData['idxFavailable']['checked'] = false;
}
$arrData['idxFsummary']['value'] = $strQuery['book_ds'];
}
$this->mysmarty->assign('arrData',$arrData);
$this->mysmarty->view('v_booksinput.php');
}
这可能吗?? :
<td>{php} echo form_input($idxFtitle);{/php}</td>
答案 0 :(得分:0)
你可以自己写smarty-function来做你想做的事。
{function name="my_input" data}
<input name="{data['value']}"></input>
{/function}