```
2. 單行 ```
```
3. 多行(一般) ```
```
4. 多行(網頁編輯器)
php ```
$DirName = "prod";
mk_dir(WEB_PATH . "/uploads/{$DirName}");
mk_dir(WEB_PATH . "/uploads/{$DirName}/image");
mk_dir(WEB_PATH . "/uploads/{$DirName}/flash");
include_once WEB_PATH . "/class/ck.php";
$fck = new CKEditor($DirName, "content", $row['content']);
$fck->setHeight(350);
$row['content'] = $fck->render();
```
template ```
<{$row.content}>
```
5. 下拉選單
程式 - 預設值 ```
$row['kind'] = isset($row['kind']) ? $row['kind']: "";
$row['kind_options'] = get_kind_options($row['kind']);
```
程式 - 函數
預設值 selected :代表被選取 ```
function get_kind_options($default=""){
$kind_options = array(
"1"=>"類別1",
"2"=>"類別2",
"3"=>"類別3",
"4"=>"類別4",
"5"=>"類別5"
);
$options = "";
foreach($kind_options as $key=> $option){
$selected = ($default == $key) ? " selected":"";
$options .="";
}
return $options;
}
```
樣板 ```
```
6. 單選
記得表單的 name 要一樣 ```
```
7. 日期
程式 - 預設值 ```
#目前日期时间戳記 1970 00:00:00 GMT 的秒數
$now = strtotime("now");//得到目前網頁伺服器的「时间戳記」
$row['date'] = isset($row['date']) ? $row['date']: $now;
$row['date'] = date("Y-m-d",$row['date']);//格式化
```
樣板 - 一般日期 ```
```
三、使用插件
1. 日期選單
2. ckeditor網頁編輯器
3. 刪除確認視窗 sweetalert2
4. 表單驗證 bootstrapValidator