db = cs4_open(); //- レシピ写真サイズ判定 if("1" == $p['version']){ $photo_size = 1; }else{ $photo_size = 0; } //- au Ver.2 対応 if("e" == $p['carrier'] && $p['version'] == "2"){ $photo_size = 1; } //- 前回分があるか判定(とりあえず直近一週間以内) $thisone_date = mktime(substr($jouzu_detail[0]['open_date'],11,2),substr($jouzu_detail[0]['open_date'],14,2),substr($jouzu_detail[0]['open_date'],17,2),substr($jouzu_detail[0]['open_date'],5,2),substr($jouzu_detail[0]['open_date'],8,2),substr($jouzu_detail[0]['open_date'],0,4)); $tmp_date = date("Ymd",mktime(0,0,0,substr($jouzu_detail[0]['open_date'],5,2),substr($jouzu_detail[0]['open_date'],8,2) + 7,substr($jouzu_detail[0]['open_date'],0,4))); $prev_id = ""; $tmp_jouzu = get_JouzuDetail($tmp_date); for($i=0;$i substr($tmp_jouzu[$i]['open_date'],0,4), 'month' => substr($tmp_jouzu[$i]['open_date'],5,2), 'day' => substr($tmp_jouzu[$i]['open_date'],8,2), 'hour' => substr($tmp_jouzu[$i]['open_date'],11,2), 'minute' => substr($tmp_jouzu[$i]['open_date'],14,2), 'second' => substr($tmp_jouzu[$i]['open_date'],17,2) ); $mktime_tmp_jouzu = mktime( sprintf("%02d",$arr_tmp_date['hour']), sprintf("%02d",$arr_tmp_date['minute']), sprintf("%02d",$arr_tmp_date['second']), sprintf("%02d",$arr_tmp_date['month']), sprintf("%02d",$arr_tmp_date['day']), sprintf("%04d",$arr_tmp_date['year']) ); */ /* print $jouzu_detail[$i]['title']." :: "; print $tmp_jouzu[$i]['open_date']." => "; var_dump($mktime_tmp_jouzu); print "
"; */ /* if($thisone_date < $mktime_tmp_jouzu){ if(!empty($prev_detail)){ if($prev_detail > $tmp_jouzu[$i]){ $prev_detail = $tmp_jouzu[$i]; } }else{ $prev_detail = $tmp_jouzu[$i]; } break; } */ if($jouzu_detail[0]['uniq_id'] == $tmp_jouzu[$i]['uniq_id']){ break; }else{ $prev_id = $tmp_jouzu[$i]['uniq_id']; } } //- ディレクトリ名(コンテンツ名)取得 $dir_name = substr(strrchr(dirname( __FILE__ ) , '/'), 1); // テンプレート読み込み $template =& loadTemplate( $p ); $template->setVariable('recipe_name',$jouzu_detail[0]['rcp_nm']); $img_filename = array(sprintf("%s_n.jpg",$jouzu_detail[0]['uniq_id']),sprintf("%s_n-s.jpg",$jouzu_detail[0]['uniq_id'])); switch($photo_size){ case "0": $img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]); $another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); } clearstatcache(); break; case "1": $img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]); $another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); } clearstatcache(); break; default: break; } //- 画像セット switch($photo_size){ case "0": if(!empty($jouzu_detail[0]['test_kty_image'])){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$jouzu_detail[0]['test_kty_image']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__ShowImage__'); } break; case "1": if(!empty($jouzu_detail[0]['test_kty_image_mini'])){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('image_id',$jouzu_detail[0]['test_kty_image_mini']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__ShowImage__'); } break; } //- 公開日セット $tmp = substr($jouzu_detail[0]['open_date'],0,12); $date_arr = explode("-",$tmp); $day = get_Day(date("w",mktime(0,0,0,$date_arr[1],$date_arr[2],$date_arr[0]))); $date_str = sprintf("%d/%d (%s)",$date_arr[1],$date_arr[2],$day); $template->setVariable('open_date',$date_str); //- タイトルセット $template->setVariable('title',str_replace('/okazu/','/okazu_new/',$jouzu_detail[0]['title'])); //- 本文セット $template->setVariable('body',str_replace('/okazu/','/okazu_new/',$jouzu_detail[0]['test_kty_body'])); //- 次へリンク if(!empty($prev_id)){ $template->setCurrentBlock('__Prev__'); $template->setVariable('jouzu_id',$prev_id); $template->parseCurrentBlock(); } //- 前に戻るリンク if(!empty($jouzu_detail[1])){ $template->setCurrentBlock('__Next__'); $template->setVariable('jouzu_id',$jouzu_detail[1]['uniq_id']); $template->parseCurrentBlock(); } /* for($i=0;$isetCurrentBlock('__Ingedients__'); $template->setVariable('Ingredients',$ing_name); $template->setVariable('amount',sprintf(":%s",$ing_amount)); $template->parseCurrentBlock(); } */ //- コンテンツトップ戻りリンク /* if(strstr(date("Y-m-d"),$jouzu_detail['open_date'])){ $template->hideBlock('__ReturnContentsTop__'); }else{ $template->setCurrentBlock('__ReturnContentsTop__'); $template->setVariable('contents_top_url','jouzu_detail.php'); $template->setVariable('contents_top',"カツ代の料理上手"); $template->parseCurrentBlock(); } */ //- access_log 記録 //$ret = bsc_insert_acslog($this->db,$detail[0],"r",$p['uid']); if($p['carrier'] == 'i'){ header( "Content-Type: application/xhtml+xml;charset=EUC-JP" ); } $template->show(); cs4_close($this->db); } jouzu_detail( $p , $jouzu_detail); ?>