db = cs4_open(); //- 朝ごはん $asagohan_top = get_rcpList($this->db, $csv_asagohan_top); //- 昼ごはん $lunch_top = get_rcpList($this->db, $csv_lunch_top); //- おやつ $sweets_top = get_rcpList($this->db, $csv_sweets_top); //- 晩ごはん $okazu_top = get_rcpList($this->db, $csv_okazu_top); //- DB開放 cs4_close($this->db); //****************************************************** // レシピ切り替え処理 //****************************************************** //現在時刻を取得 $today = getdate(); $hours = $today[hours]; //22:00以降は翌日のレシピを表示するための処理 if($hours >= 22){ $asagohan_top['today'] = $asagohan_top['tomorrow']; $lunch_top['today'] = $lunch_top['tomorrow']; $sweets_top['today'] = $sweets_top['tomorrow']; $okazu_top['today'] = $okazu_top['tomorrow']; } //****************************************************** // レシピ表示処理 //****************************************************** //- 朝ごはん if(!empty($asagohan_top['today'])){ for($i=0;$isetCurrentBlock('__asagohan_ShowImage__'); $template->setVariable('asagohan_image_id',$asagohan_top['today'][0]['uniq_id']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__asagohan_ShowImage__'); } } $template->setCurrentBlock('__asagohan_List__'); $template->setVariable('asagohan_rcp_no',$asagohan_top['today'][0]['uniq_id']); $template->setVariable('asagohan_title',$asagohan_top['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } } //- 昼ごはん if(!empty($lunch_top['today'])){ for($i=0;$isetCurrentBlock('__lunch_ShowImage__'); $template->setVariable('lunch_image_id',$lunch_top['today'][0]['uniq_id']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__lunch_ShowImage__'); } } $template->setCurrentBlock('__lunch_List__'); $template->setVariable('lunch_rcp_no',$lunch_top['today'][0]['uniq_id']); $template->setVariable('lunch_title',$lunch_top['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } } //- おやつ if(!empty($sweets_top['today'])){ for($i=0;$isetCurrentBlock('__sweets_ShowImage__'); $template->setVariable('sweets_image_id',$sweets_top['today'][0]['uniq_id']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__sweets_ShowImage__'); } } $template->setCurrentBlock('__sweets_List__'); $template->setVariable('sweets_rcp_no',$sweets_top['today'][0]['uniq_id']); $template->setVariable('sweets_title',$sweets_top['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } } //- 晩ごはん(晩ごはんの場合は4品あるので1つだけ出力) if(!empty($okazu_top['today'])){ for($i=0;$i<1;$i++){ if(("3" == $p['version']) || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] ){ $okaze_img_path = sprintf("/home/www/public/image/recipe/%d_n-thm.jpg",$okazu_top['today'][0]['uniq_id']); clearstatcache(); if(file_exists($okaze_img_path)){ $template->setCurrentBlock('__okazu_ShowImage__'); $template->setVariable('okazu_image_id',$okazu_top['today'][0]['uniq_id']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__okazu_ShowImage__'); } } $template->setCurrentBlock('__okazu_List__'); $template->setVariable('okazu_rcp_no',$okazu_top['today'][0]['uniq_id']); $template->setVariable('okazu_title',$okazu_top['today'][0]['rcp_nm']); $template->parseCurrentBlock(); } } $template->show(); } okazu_top( $p ); ?>