db = cs4_open(); //- 写真付き日替わりレシピ取得 $lunch_top = get_rcpList($this->db, $csv_lunch_top); //現在時刻を取得 $today = getdate(); $hours = $today[hours]; //22:00以降は翌日のレシピを表示するための処理 if($hours >= 22){ $lunch_top['today'] = $lunch_top['tomorrow']; } $img_filename = sprintf("%s_n-s.jpg",$lunch_top['today'][0]['uniq_id']); $img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename); //- 10件分を取得 $start = (($p['page'] - 1) * $show_line) + 1; for($i=$start ; $i < count($csv_lunch) && $i < ($p['page'] * $show_line) + 1 ;$i++){ $line_arr = explode(",",$csv_lunch[$i]); if(is_numeric(trim($line_arr[0]))){ $lunch_list[] = get_rcpDetail($this->db, $line_arr[0]); } } //- 検索結果ゼロ処理 $list_ct = count($csv_lunch);//- 取得件数 if('0' == $list_ct){ print "Not Found your request Recipe !!"; exit; } // テンプレート読み込み $template =& loadTemplate( $p ); if(!empty($lunch_top['today'][0])){ $template->setCurrentBlock('__ShowImage__'); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); // $template->setVariable('img_id',$lunch_top['today'][0]['uniq_id']); } $template->parseCurrentBlock(); $template->setCurrentBlock('__TopRecipe__'); $template->setVariable('rcp_no',$lunch_top['today'][0]['uniq_id']); $template->setVariable('title',$lunch_top['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } for($i=0;$isetCurrentBlock('__List__'); $template->setVariable('rcp_no',$lunch_list[$i][0]['uniq_id']); $template->setVariable('title',$lunch_list[$i][0]['rcp_nm']); $img_f = sprintf("%s_n-s.jpg",$lunch_list[$i][0]['uniq_id']); $img = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_f); if(file_exists($img)){ $template->setVariable('img',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img))); } $template->parseCurrentBlock(); } //- ページ送り処理 (Prev) if('1' < $p['page']){ $template->setCurrentBlock('__PagePrev__'); $template->setVariable('prev_page',$p['page'] - 1); $template->parseCurrentBlock(); } //- ページ送り処理 (Next) if(($p['page'] * $show_line) < $list_ct){ $template->setCurrentBlock('__PageNext__'); $template->setVariable('next_page', $p['page'] + 1); $template->parseCurrentBlock(); } $template->setVariable('site_top',SITE_NAME); $template->show(); cs4_close($this->db); } lunch_list( $p ); ?>