func_code = "product"; $func_title = array ( 'tw' => '產品專區', 'cn' => '產品專區', 'en' => 'Product', ); $CFG->func_title = $func_title[$CFG->lang]; $CFG->title_disable = 1; //定義資料表 $CFG->table_name = $CFG->table_prefix."product"; $CFG->table_type = $CFG->table_prefix."product_type"; $CFG->table_image = $CFG->table_prefix."product_image"; $CFG->folder_path = $WFunc->get_archive_folder($CFG->func_code); // 上傳目錄 //預設分頁 $CFG->page_limit = 16; // ---------------------------------------------------------------------------- // 主判斷式 // ---------------------------------------------------------------------------- if ($_REQUEST["mode"]) { $_REQUEST["mode"]($_REQUEST); } else { $_SESSION['web']['back_url'] = $CFG->this_url; show($_REQUEST); } // 主判斷式結束 // ---------------------------------------------------------------------------- // 函式集 // ---------------------------------------------------------------------------- function show($frm) { global $CFG,$WFunc,$UFunc; $first_query_string = "SELECT * FROM $CFG->table_type WHERE status = '1' AND lang = '$CFG->lang' ORDER BY sequence ASC"; $first_db_result = mysql_query($first_query_string); $first_result = mysql_fetch_assoc($first_db_result); if (!$frm['type_id']) { $frm['type_id'] = $first_result['id']; } $query_string = "SELECT * FROM $CFG->table_name WHERE type_id = '$frm[type_id]' AND lang = '$CFG->lang' ORDER BY sequence ASC"; $db_result = mysql_query($query_string); $result = mysql_fetch_assoc($db_result); #################################################################### # 載入樣板 #################################################################### // 頁首 !$_REQUEST['pjax'] ? include ($CFG->themes."header.php") : false; include ($CFG->lib."funcs/header_func.php"); // 畫面 include ("themes/$CFG->lang/list.php"); // 頁尾 !$_REQUEST['pjax'] ? include ($CFG->themes."footer.php") : false; } function detail($frm) { global $CFG,$WFunc,$UFunc; $query_string = "SELECT * FROM $CFG->table_name WHERE id = '$frm[id]' AND status = '1' AND lang = '$CFG->lang'"; $db_result = mysql_query($query_string); $result = mysql_fetch_assoc($db_result); $WFunc->check_null_content($result); $field = array ( 'counts' => $result['counts'] + 1, ); $update_string = $WFunc->sql_update_string($CFG->table_name,$field,"id = '$frm[id]'"); mysql_query($update_string); $CFG->func_title = $result['name'].' - '.$CFG->func_title; $CFG->web_description = $WFunc->sub_str($result['content'],0,300); $WFunc->unset_cookie('lang'); $WFunc->set_cookie("lang", $result['lang'], time()+3600*24*365); // 上一則 $last_query_string = "SELECT * FROM $CFG->table_name WHERE type_id = '$result[type_id]' AND id < '$result[id]' AND status = '1' AND lang = '$CFG->lang' ORDER BY id DESC"; $last_db_result = mysql_query($last_query_string); $last_result = mysql_fetch_assoc($last_db_result); // 下一則 $next_query_string = "SELECT * FROM $CFG->table_name WHERE type_id = '$result[type_id]' AND id > '$result[id]' AND status = '1' AND lang = '$CFG->lang' ORDER BY id ASC"; $next_db_result = mysql_query($next_query_string); $next_result = mysql_fetch_assoc($next_db_result); #################################################################### # 載入樣板 #################################################################### // 頁首 !$_REQUEST['pjax'] ? include ($CFG->themes."header.php") : false; include ($CFG->lib."funcs/header_func.php"); // 畫面 include ("themes/$CFG->lang/list.php"); // 頁尾 !$_REQUEST['pjax'] ? include ($CFG->themes."footer.php") : false; } function get_db_result($type_id) { global $CFG,$WFunc,$UFunc; $query_string = "SELECT * FROM $CFG->table_name WHERE type_id = '$type_id' AND status = '1' AND lang = '$CFG->lang'"; $db_result = mysql_query($query_string); return $db_result; } ?>