/templates/default/tpl/creative\_header.html
```
```
五、
/function.php
```
#################################
# 輪播圖
#
#################################
function slider_home() {
global $mysqli, $smarty;
#取得所有記錄
$sql = "select files_sn,file_name,sub_dir
from `creative_files_center`
where `col_name`='system_slider_image'
order by `sort` "; //die($sql);
$result = $mysqli->query($sql) or die(printf("Error: %s
" . $sql, $mysqli->sqlstate));
$rows = array();
while ($row = $result->fetch_assoc()) {
#過濾撈出資料
//Array ( [sn] => 3 [ofsn] => 0 [kind] => nav_home [title] => asdfasdf [sort] => 0 [enable] => 1 [url] => asdfasdf [target] => 0 [col_sn] => 0 [content] => )
$row['files_sn'] = intval($row['files_sn']);
//http://www.w3school.com.cn/php/func_string_htmlspecialchars.asp
$row['file_name'] = htmlspecialchars($row['file_name'], ENT_QUOTES); // 轉換雙引號和單引號
$row['sub_dir'] = htmlspecialchars($row['sub_dir'], ENT_QUOTES); // 轉換雙引號和單引號
$rows[] = $row;
}
//print_r($rows);die();
$smarty->assign("slider_home", $rows);
return;
}
```
/head.php
```
slider_home();
```
/templates/default/tpl/creative\_header.html
```
```