setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$okazu_list['today'][0]['uniq_id']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__ShowImage__'); } } $template->setCurrentBlock('__List__'); //$template->setVariable('image_id',$okazu_list['today'][$i]['uniq_id']); $template->setVariable('rcp_no',$okazu_list['today'][0]['uniq_id']); $template->setVariable('title',$okazu_list['today'][0]['rcp_nm']); $template->setVariable('comment',$okazu_list['today'][0]['phrase']); $template->parseCurrentBlock(); //} } */ //- 日替わり晩御飯セット //ユーザの好みごとに表示する内容が異なる。画像がある場合のみ1つ表示する。 //if(!empty($okazu_list)){ if(!empty($myrecipe_list['main'])){ if($main_index >= 1){ for($i=0;$i<1;$i++){ if(("3" == $p['version']) || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier'] ){ $okaze_img_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$myrecipe_list['main'][$main_index + $i]['rcp_no']); clearstatcache(); if(file_exists($okaze_img_path)){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$myrecipe_list['main'][$main_index + $i]['rcp_no']); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__List__'); $template->setVariable('comment',$myrecipe_list['main'][$main_index + $i]['rcp_exp']); $template->setVariable('rcp_no',$myrecipe_list['main'][$main_index + $i]['rcp_no']); $template->setVariable('title',$myrecipe_list['main'][$main_index + $i]['rcp_nm']); $template->parseCurrentBlock(); } }else{ for($i=0;$i<$main_index;$i++){ if(('i' == $p['carrier'] && '2' == $p['version']) || ('v' == $p['carrier'] && '3' == $p['version']) || ('e' == $p['carrier'] && '3' == $p['version']) || ('w' == $p['carrier']) || ('g' == $p['carrier'])){ $okaze_img_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$myrecipe_list['main'][$main_index - $i]['rcp_no']); if(file_exists($okaze_img_path)){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$myrecipe_list['main'][$main_index + $i]['rcp_no']); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__List__'); $template->setVariable('comment',$myrecipe_list['main'][$main_index - $i]['rcp_exp']); $template->setVariable('rcp_no',$myrecipe_list['main'][$main_index - $i]['rcp_no']); $template->setVariable('title',$myrecipe_list['main'][$main_index - $i]['rcp_nm']); $template->parseCurrentBlock(); } } }else{ //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } $where = "rcp_dlt = 0"; $sql = "select rcp_no, rcp_nm, rcp_exp, rcp_f_nm"; $sql.= sprintf(" from contents_data_bsc_r_new where %s",$where); $res = $db->query($sql); if(DB::isError($res)){ echo "

クエリの送信が失敗しました。

"; exit; } //件数取得 $non_num = $res->numRows(); $nowdate_count = (mktime(0,0,0,date("m"),date("d"),date("Y")) - mktime(0,0,0,1,1,2006)) / (24*60*60); if(!empty($non_num)){ $main_index = $nowdate_count % $non_num; } while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $rcp_list['rcp_nm'][] = $row['rcp_no']; $rcp_list['rcp_no'][] = $row['rcp_nm']; $rcp_list['rcp_exp'][] = $row['rcp_exp']; $rcp_list['rcp_f_nm'][] = $row['rcp_f_nm']; } if(('i' == $p['carrier'] && '2' == $p['version']) || ('v' == $p['carrier'] && '3' == $p['version']) || ('e' == $p['carrier'] && '3' == $p['version']) || ('w' == $p['carrier']) || ('g' == $p['carrier'])){ $okaze_img_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$rcp_list['rcp_nm'][$main_index]); if(file_exists($okaze_img_path)){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$rcp_list['rcp_nm'][$main_index]); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__List__'); $template->setVariable('comment',$rcp_list['rcp_exp'][$main_index]); $template->setVariable('title',$rcp_list['rcp_no'][$main_index]); $template->setVariable('rcp_no',$rcp_list['rcp_nm'][$main_index]); $template->parseCurrentBlock(); $template->setCurrentBlock('__Non_Rcp__'); $template->setVariable('non_rcp',"該当のレシピがありません。お好み設定を変更してください。"); $template->parseCurrentBlock(); //DB開放 $db->disconnect(); } //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } //******************************// // メイン取得SQL // //******************************// $where = "G.r_gnr_no = Gs.r_gnr_no "; $where .= "and Ss.r_style_no = '1' "; $where .= "and Gs.rcp_no = N.rcp_no "; $where .= "and Ks.rcp_no = N.rcp_no "; $where .= "and Ss.rcp_no = N.rcp_no "; $where .= "and Ks.rcp_no = Gs.rcp_no "; $where .= "and K.r_knd_no = Ks.r_knd_no "; $where .= "and Ss.r_style_no = S.r_style_no "; $where .= "and K.r_knd_dlt = 0 "; $where .= "and Ks.r_knd_dlt = 0 "; $where .= "and G.r_gnr_dlt = 0 "; $where .= "and Gs.r_gnr_s_dlt = 0 "; $where .= "and Ss.r_style_dlt = 0 "; $where .= "and S.r_style_dlt = 0 "; $where .= "and N.rcp_dlt = 0 "; $from = "contents_data_bsc_r_new N, "; $from .= "contents_data_bsc_r_gnr G, contents_data_bsc_r_gnr_s Gs, "; $from .= "contents_data_bsc_r_knd K, contents_data_bsc_r_knd_s Ks, "; $from .= "contents_data_bsc_r_style S, contents_data_bsc_r_style_s Ss"; $where1 = "and Ks.r_knd_no = '2' "; $sql = "select N.rcp_no, N.rcp_nm, N.rcp_exp"; $sql.= sprintf(" FROM %s Where %s %s",$from,$where,$where1); $res = $db->query($sql); if(DB::isError($res)){ echo "

クエリの送信が失敗しました。

"; exit; } //件数取得 $num = $res->numRows(); $i = 0; $nowdate_count = (mktime(0,0,0,date("m"),date("d"),date("Y")) - mktime(0,0,0,1,1,2006)) / (24*60*60); if(!empty($num)){ $index = $nowdate_count % $num; } while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $array[main_no][$i] = $row['rcp_no']; $array[main_nm][$i] = $row['rcp_nm']; $array[main_cmt][$i] = $row['rcp_exp']; $i ++; } //お弁当画像パス取得 $img_path1 = sprintf("/home/www/public/image/recipe/%d_n-thm.jpg",$array[main_no][$index]); //お弁当画像表示処理 if(file_exists($img_path1)){ $template->setCurrentBlock('__Main_Image__'); $template->setVariable('main_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path1))); $template->parseCurrentBlock(); }else{ $template->hideBlock('__Main_Image__'); } $template->setVariable('bentou_rcp',$array[main_no][$index]); $template->setVariable('bentou_title',$array[main_nm][$index]); $template->setVariable('bentou_comment',$array[main_cmt][$index]); /* //- 日替わり弁当セット $template->setVariable('bentou_rcp',$bentou_top['today'][0]['uniq_id']); $template->setVariable('bentou_title',$bentou_top['today'][0]['rcp_nm']); $template->setVariable('bentou_comment',$bentou_top['today'][0]['phrase']); */ //- 告知スペース if($csv_notice){ foreach($csv_notice as $key => $val){ $tmp_val = explode(",",$val); $tmp_date = explode("/",$tmp_val[0]); $comp_date = sprintf("%04d%02d%02d",$tmp_date[0],$tmp_date[1],$tmp_date[2]); if(date("Ymd") == $comp_date){ if(("3" == $p['version']) || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier'] ){ if("sp_" != substr($tmp_val[3],0,3) && is_numeric(trim($tmp_val[3]))){ $notice_img_path = sprintf("/home/www/public/image/recipe/%d_n-thm.jpg",trim($tmp_val[3])); }else{ $notice_img_path = sprintf("/home/www/public/image/notice/%s",trim($tmp_val[3])); } clearstatcache(); if(file_exists($notice_img_path)){ $template->setCurrentBlock('__ShowNoticeImage__'); $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$notice_img_path))); $template->parseCurrentBlock(); }else{ $template->hideBlock('__ShowNoticeImage__'); } } if(!empty($tmp_val[1])){ $template->setCurrentBlock('__Cap1__'); $template->setVariable('caption1',$tmp_val[1]); $template->parseCurrentBlock(); } if(!empty($tmp_val[2])){ $template->setCurrentBlock('__Cap2__'); $template->setVariable('caption2',$tmp_val[2]); $template->parseCurrentBlock(); } $template->touchBlock('__TopNotice__'); break; } } }else{ $template->hideBlock('__ShowNoticeImage__'); $template->hideBlock('__Cap1__'); $template->hideBlock('__Cap2__'); $template->hideBlock('__TopNotice__'); } /* if("2Bv8rX5DtscDBGz" == $p['uid'] || "2GsmVo3F1J4u3lb" == $p['uid'] || "2iG8TmdCDdsghYq" == $p['uid']){ //- 903 : 2Bv8rX5DtscDBGz //- 902 : 2iG8TmdCDdsghYq //- 703 : 2GsmVo3F1J4u3lb // $p['template_path'] = "template_v3_ext"; $p['version'] = 3; //-- テンプレートへセット $template = ""; $template =& loadTemplate_Test( $p ); } */ //- 日記タイトルセット if(!empty($todays_diary[0])){ $template->setCurrentBlock('__DiaryTitle__'); $template->setVariable('diary_title',$todays_diary[0]['title']); $template->parseCurrentBlock(); } /* //- 料理上手タイトルセット if(!empty($todays_jouzu[0])){ $template->setCurrentBlock('__JouzuTitle__'); $template->setVariable('jouzu_title',$todays_jouzu[0]['title']); $template->parseCurrentBlock(); } //- 本日の新レシピ if(!empty($top_today['today'])){ if(("3" == $p['version']) || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier'] ){ $template->setCurrentBlock('__ShowImage__'); clearstatcache(); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("\"本日の新レシピ\"",str_replace(KTY_SERVER_ROOT,"",$img_path))); } $template->parseCurrentBlock(); } $template->setCurrentBlock('__TopRecipe__'); $template->setVariable('date',sprintf("%d/%d",substr($top_today['today_date'],4,2),substr($top_today['today_date'],6,2))); $template->setVariable('rcp_no',$top_today['today'][0]['uniq_id']); $template->setVariable('title',$top_today['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } */ //- xhtml if("i" == $p['carrier'] && $p['xhtml']){ ini_set('default_mimetype', 'application/xhtml+xml'); }elseif("i" == $p['carrier'] && ereg("F900i\(",$p['agent'])){ ini_set('default_mimetype', 'application/xhtml+xml'); header("Content-Type: application/xhtml+xml;charset=Shift_JIS"); }elseif("w" == $p['carrier'] && $p['xhtml']){ //header("Content-Type: application/xhtml+xml;charset=Shift_JIS"); //header("Content-Type: application/xhtml+xml;charset=EUC-JP"); /* if("test.katsuyo.net" == $_SERVER['HTTP_HOST']){ print "Load -> ".$template_dir."/".$p['template']."
"; print "Version -> ".$p['version']."
"; print "Device -> ".$p["device"]."
"; } */ }elseif("g" == $p['carrier'] && $p['xhtml']){ } $template->show(); } index($p); ?>