Title1

Title2

Title3

8-7 creative_header.html

/uploads/ugm_creative/tpl/creative_header.html


###############################################################################
#  寫入slider_home.html
###############################################################################
function run_system_slider_home($sn, $name, $kind) {
	global $DIRNAME, $xoopsDB;
	#---- 過濾讀出的變數值 ----
	$myts = MyTextSanitizer::getInstance();
	#---- 檢查資料夾
	mk_dir(XOOPS_ROOT_PATH . "/uploads/{$DIRNAME}/system");
	mk_dir(XOOPS_ROOT_PATH . "/uploads/{$DIRNAME}/system/{$kind}");

	$tbl = "ugm_creative_system";
	$kind = "slider_home";
	#---- 輪播圖 標題
	$name = "system_slider_home_title";
	$system_slider_home_title = $myts->htmlSpecialChars(get_modules_system_var($tbl, $kind, $name));
	#---- 輪播圖 內容
	$html = 1;
	$br = 0;
	$name = "system_slider_home_content";
	$system_slider_home_content = $myts->displayTarea(get_modules_system_var($tbl, $kind, $name), $html, 1, 0, 1, $br);
	#---- 輪播圖 連結網址
	$name = "system_slider_home_url";
	$system_slider_home_url = $myts->htmlSpecialChars(get_modules_system_var($tbl, $kind, $name));
	#---- 輪播圖 啟用狀態
	$name = "system_slider_home_enable";
	$system_slider_home_enable = intval(get_modules_system_var($tbl, $kind, $name));
	#---- 輪播圖 外連狀態
	$name = "system_slider_home_target";
	$system_slider_home_target = intval(get_modules_system_var($tbl, $kind, $name));
	$system_slider_home_target = $system_slider_home_target ? " target='_blank'" : "";

	#---- 輪播 圖片
	$name = "system_slider_home_pic";
	$sql = "select file_name,sub_dir
	        from " . $xoopsDB->prefix("ugm_creative_files_center") . "
	        where col_name = '{$name}'
	        order by sort
	       ";
	$result = $xoopsDB->query($sql);
	$i = 0;
	$pic = "";
	while ($row = $xoopsDB->fetchArray($result)) {
		$row['file_name'] = $myts->htmlSpecialChars($row['file_name']);
		$row['sub_dir'] = $myts->htmlSpecialChars($row['sub_dir']);
		$comma = $i ? "," : "";
		$pic .= "     {$comma}'" . XOOPS_UPLOAD_URL . "/" . $DIRNAME . $row['sub_dir'] . "/" . $row['file_name'] . "'\n";
		$i++;
	}
	//print_r($pic);die();
	$content = "";
	$content = "<script src='<{xoAppUrl modules/ugm_tools/class/backstretch/jquery.backstretch.min.js}>'></script>\n";
	$content .= "<script type='text/javascript'>\n";
	$content .= " \$(document).ready(function(){\n";
	$content .= "   \$('#header').backstretch([\n";
	$content .= $pic;
	$content .= "   ], {duration: 3000, fade: 750});\n";
	$content .= " });\n";
	$content .= "</script>\n";
	$content .= "<header id='header'>\n";
	$content .= " <div class='header-content'>\n";
	$content .= "   <div class='header-content-inner'>\n";
	$content .= "     <h1 id='homeHeading'>{$system_slider_home_title}</h1>\n";
	$content .= "     <hr>\n";
	$content .= "     <p>{$system_slider_home_content}</p>\n";
	$content .= "     <a href='{$system_slider_home_url}' class='btn btn-primary btn-xl page-scroll' {$system_slider_home_target}>Find Out More</a>\n";
	$content .= "   </div>\n";
	$content .= " </div>\n";
	$content .= "</header>\n";

	$file = XOOPS_ROOT_PATH . "/uploads/ugm_creative/tpl/creative_header.html";
	$f = fopen($file, 'w'); //以寫入方式開啟文件
	fwrite($f, $content); //將新的資料寫入到原始的文件中
	fclose($f);

}