/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*
Program :
Description :
Programmer : ไชยรัตน์ สุนทรวิภาต
Individual
Email : pipo@sixhead.com
Website : http://www.sixhead.com
: http://www.todaysoftware.com
Office
Email : pipo@digithais.com
Website : http://www.digithais.com
Date :
Modify log :
*/
/*------------------------------------------------------------------*/
/*- Require --------------------------------------------------------*/
require_once "../../../module/_config.php";
require_once "../../../module/_module.php";
require_once "../../../module/_module_control.php";
require_once "../../../module/SiXhEaD.Template.php";
require_once "../../../module/SiXhEaD.SplitPage.php";
/*------------------------------------------------------------------*/
/*- Template -------------------------------------------------------*/
$tp_detail = "_tp_detail.html";
/*------------------------------------------------------------------*/
/*- Config & Misc --------------------------------------------------*/
$strCurrentLangauge = "En";
/*------------------------------------------------------------------*/
/*- Request --------------------------------------------------------*/
$ContentId = (int)$_REQUEST[ContentId];
/*------------------------------------------------------------------*/
/*- Program --------------------------------------------------------*/
$tp = new Template($tp_detail);
$objDb = mysql_connect($strCfgDbHost,$strCfgDbUser,$strCfgDbPass);
mysql_select_db($strCfgDbName);
//if (!$objDb) { die('Could not connect: ' . "" /*mysql_error()*/); }
mysql_query("SET NAMES TIS620");
mysql_query("SET character_set_results=tis620");
$strSql = "SELECT * FROM $strCfgDbTableNews WHERE Active = 'Y' AND ContentId = $ContentId";
$objResult = mysql_query($strSql);
//if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
#$ContentCategoryId = $row[ContentCategoryId];
$Title = $row["Title$strCurrentLangauge"];
$Detail = $row["Detail$strCurrentLangauge"];
$Tag = $row["Tag$strCurrentLangauge"];
$ContentDate = $row[ContentDate];
$File2Name = $row[File2Name];
$ContentDateShow = formatDateTimeString($ContentDate,$strCurrentLangauge);
}
mysql_free_result($objResult);
$Tags = preg_split("/,/", $Tag, -1, PREG_SPLIT_NO_EMPTY);
if (is_array($Tags) && $Tag != "") {
$strTagSql = "";
foreach ($Tags as $Tag) {
$strTagSql .= " Tag$strCurrentLangauge LIKE '%$Tag%' OR";
}
$strTagSql = preg_replace("/OR$/", "", $strTagSql);
$tp->Block("RelateTitle");
$strSql = "SELECT * FROM $strCfgDbTableNews WHERE (Title$strCurrentLangauge NOT LIKE '' AND Active = 'Y' AND ContentId != $ContentId) AND ($strTagSql)";
#echo "$strSqlChangeMe";
$objResult = mysql_query($strSql);
//if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$ContentIdRelate = $row[ContentId];
$TitleRelate = $row["Title$strCurrentLangauge"];
#$ContentDateShow = formatDateTimeString($ContentDate,$strCurrentLangauge);
$tp->Apply();
}
mysql_free_result($objResult);
}
//-- แสดงดาวน์โหลด
$strSql = "SELECT * FROM $strCfgDbTableNewsFile WHERE Active = 'Y' AND ContentId = $ContentId AND File1Name <>'' AND Language ='$strCurrentLangauge' ";
$objResult = mysql_query($strSql);
//if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$FileTitle = $row["Title"];
$FileName = $row["File1Name"];
}
mysql_free_result($objResult);
if($FileTitle && $FileName){
$DownloadPdfFile="
$FileTitle";
}
//-- แสดงลิงค์ url ภายนอก
$strSql = "SELECT * FROM $strCfgDbTableNewsFile WHERE Active = 'Y' AND ContentId = $ContentId AND Url <>'' AND Language ='$strCurrentLangauge' ";
$objResult = mysql_query($strSql);
//if (!$objResult) { echo "$strSqlChangeMe"; die("Invalid query: " . "" /*mysql_error()*/); }
while($row = mysql_fetch_array($objResult)) {
$UrlTitle = $row["Title"];
$UrlName = $row["Url"];
$LinkExternalUrl .="
$UrlTitle";
}
mysql_free_result($objResult);
if ($File2Name) {
$File2NameShow = <<
Data;
}
mysql_close($objDb);
$tp->Display();
exit;
/*------------------------------------------------------------------*/
?>