############################### # 預設 ############################### function opForm($sn=""){ global $db,$smarty; /* `sn` int(10) unsigned NOT NULL auto_increment comment 'prod_sn', `kind` smallint(5) unsigned NOT NULL default 0 comment '分類', `title` varchar(255) NOT NULL default '' comment '名稱', `summary` text NULL comment '摘要', `content` text NULL comment '內容', `price` int(10) unsigned NOT NULL comment '價格', `amount` int(10) unsigned NOT NULL comment '數量', `enable` enum('1','0') NOT NULL default '1' comment '狀態', `choice` enum('1','0') NOT NULL default '0' comment '精選', `date` int(10) unsigned NOT NULL default 0 comment '建立日期', `sort` smallint(5) unsigned NOT NULL default 0 comment '排序', `counter` int(10) unsigned NOT NULL default 0 comment '人氣', `icon` varchar(255) NOT NULL default '' comment '圖示', */ if($sn){ #編輯 }else{ #新增 $row =array(); } $row['sn'] = isset($row['sn']) ? $row['sn']: ""; $row['kind'] = isset($row['kind']) ? $row['kind']: ""; $row['title'] = isset($row['title']) ? $row['title']: ""; $row['summary'] = isset($row['summary']) ? $row['summary']: ""; $row['content'] = isset($row['content']) ? $row['content']: ""; $row['price'] = isset($row['price']) ? $row['price']: 0; $row['amount'] = isset($row['amount']) ? $row['amount']: 0; $row['enable'] = isset($row['enable']) ? $row['enable']: "1"; $row['choice'] = isset($row['choice']) ? $row['choice']: "0"; $row['date'] = isset($row['date']) ? $row['date']: 0; $row['sort'] = isset($row['sort']) ? $row['sort']: 0; $row['icon'] = isset($row['icon']) ? $row['icon']: ""; $smarty->assign("row", $row); $token = getTokenHTML(); $smarty->assign("token", $token); } ``` admin\_prod.tpl ``` <{if $op == "opForm"}> 商品管理 商品名稱 商品類別 <{$token}> 送出 <{/if}> ``` [https://drive.google.com/file/d/16msPPtk0WSH9q\_ckznJhzLgCCe\_BpbKx/view?usp=sharing](https://drive.google.com/file/d/16msPPtk0WSH9q_ckznJhzLgCCe_BpbKx/view?usp=sharing)
<{if $op == "opForm"}> 商品管理 商品名稱 商品類別 <{$token}> 送出 <{/if}> ``` [https://drive.google.com/file/d/16msPPtk0WSH9q\_ckznJhzLgCCe\_BpbKx/view?usp=sharing](https://drive.google.com/file/d/16msPPtk0WSH9q_ckznJhzLgCCe_BpbKx/view?usp=sharing)