############################################################################### # 產生 slider.html ############################################################################### function write_Slider_html() { global $ugmKind, $xoopsDB, $DIRNAME; $tbl = $ugmKind->get_tbl(); $kind = $ugmKind->get_kind(); $dir_name = "/photo"; //sn ofsn title sort enable kind url target col_sn $sql = "select a.sn,a.title,a.content,a.url,a.target,b.file_name,b.sub_dir from " . $xoopsDB->prefix($tbl) . " as a left join " . $xoopsDB->prefix("ugm_creative_files_center") . " as b on a.sn = b.col_sn and b.col_name = '{$kind}' and b.sort='1' where a.kind='{$kind}' and a.enable='1' order by a.sort"; //die($sql); $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); //---- 過濾資料 ------------------------*/ $myts = &MyTextSanitizer::getInstance(); $item = ""; $i = 0; while ($row = $xoopsDB->fetchArray($result)) { $row['target'] = $row['target'] ? " target='_blank'" : ""; $row['title'] = $myts->htmlSpecialChars($row['title']); $row['url'] = $myts->htmlSpecialChars($row['url']); $row['file_name'] = $myts->htmlSpecialChars($row['file_name']); $row['sub_dir'] = $myts->htmlSpecialChars($row['sub_dir']); $html = 0; $br = 1; $row['content'] = $myts->displayTarea($row['content'], $html, 1, 0, 1, $br); #大圖 if ($row['file_name'] and file_exists(XOOPS_ROOT_PATH . "/uploads/{$DIRNAME}{$row['sub_dir']}/{$row['file_name']}")) { $row['file_name'] = XOOPS_URL . "/uploads/{$DIRNAME}{$row['sub_dir']}/{$row['file_name']}"; } else { #無圖處理 $row['file_name'] = XOOPS_URL . "/modules/ugm_tools/images/no_pic/pic_1920_500.jpg"; } #相片展示 $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " {$row['url']}\n"; $item .= " \n"; $item .= " \n"; $item .= " {$row['title']}\n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; $item .= " \n"; } /* */ $content = "\n"; $content .= " \n"; $content .= " \n"; $content .= $item; $content .= " \n"; $content .= " \n"; $content .= "\n"; #---- 檢查資料夾 mk_dir(XOOPS_ROOT_PATH . "/uploads/{$DIRNAME}/tpl"); $file = XOOPS_ROOT_PATH . "/uploads/{$DIRNAME}/tpl/creative_portfolio.html"; $f = fopen($file, 'w'); //以寫入方式開啟文件 fwrite($f, $content); //將新的資料寫入到原始的文件中 fclose($f); } ```