######################################## # 表單 ######################################## function op_form($sn="") { global $mysqli,$smarty; #抓取預設值 if($sn) { #編輯 $DBV['op'] = "op_update"; $DBV['form_title'] = "編輯選單"; }else { #新增 $DBV=array(); $DBV['op'] = "op_insert"; $DBV['form_title'] = "新增選單"; } //預設值設定 //標題 title (text)、網址 url (text)、是否外連 target (radio)、是否啟用 enable (radio)、排序 sort(text) $DBV['sn'] = (isset($DBV['sn'])) ? $DBV['sn'] : ""; $DBV['title'] = (isset($DBV['title'])) ? $DBV['title'] : ""; $DBV['enable'] = (isset($DBV['enable'])) ? $DBV['enable'] : "1"; $DBV['target'] = (isset($DBV['target'])) ? $DBV['target'] : "0"; $DBV['url'] = (isset($DBV['url'])) ? $DBV['url'] : ""; $DBV['sort'] = (isset($DBV['sort'])) ? $DBV['sort'] : ""; $smarty->assign("DBV", $DBV); return; } ``` 四、在樣板製作表單 ``` {* nav_m.php and op_form *} {if $WEB.file_name == "nav_m.php" and $op == "op_form"} {$DBV.form_title} 標題 外連狀態 是 否 啟用狀態 是 否 排序 網址 送出 {/if} ```
{* nav_m.php and op_form *} {if $WEB.file_name == "nav_m.php" and $op == "op_form"} {$DBV.form_title} 標題 外連狀態 是 否 啟用狀態 是 否 排序 網址 送出 {/if} ```