smarty 模板内的辅助代码点火器
如果我将带有数组参数的 form_helper 放在我的 smarty 模板中,这可能吗?
这是我的控制器的方法:
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>
Is this possible if I put my form_helper with array parameter in my smarty template.
this is my method of my controller:
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');
}
Is this possible..? :
<td>{php} echo form_input($idxFtitle);{/php}</td>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写自己的 smarty-function 来完成您想要的操作。
You can write own smarty-function which does what you want.