require_once('../prepare.php');
function sweets_list( $p )
{
// 表示件数
$show_line = 10;
$p['page'] = (!empty($p['page']) && '0' < $p['page']) ? $p['page'] : '1';
//- スウィーツcsv取得
$csv_file = (!empty($p['id'])) ? sprintf("sweets_%d",$p['id']) : "sweets_top";
$csv_sweets_top = get_csvdata( $csv_file );
$this->db = cs4_open();
//- 写真付き日替わりレシピ取得
$sweets_top = get_rcpList($this->db, $csv_sweets_top);
//現在時刻を取得
$today = getdate();
$hours = $today[hours];
//22:00以降は翌日のレシピを表示するための処理
if($hours >= 22){
$sweets_top['today'] = $sweets_top['tomorrow'];
}
$img_filename = sprintf("%s_n-s.jpg",$sweets_top['today'][0]['uniq_id']);
$img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename);
//- ジャンル名取得
$sweets_genre = get_SweetsGenre($this->db,$p['id']);
//- 該当ジャンルのレシピ一覧取得
//softbank携帯の場合、暫定処置として50件までレシピを取得
/*
if($p['carrier'] == "v"){
$sweets_list = get_SweetsRecipe_v($this->db, $p['id'] );
}else{
$sweets_list = get_SweetsRecipe($this->db, $p['id'] );
}
*/
//- 該当ジャンルのレシピ一覧取得
$sweets_list = get_SweetsRecipe($this->db, $p['id'] );
//- 検索結果ゼロ処理
//- 取得件数
$list_ct = count($sweets_list);
// テンプレート読み込み
$template =& loadTemplate( $p );
if(!empty($sweets_top['today'][0]) && (("2" == $p['version'] && "i" == $p['carrier']) || ("2" == $p['version'] && "v" == $p['carrier']) || ("2" == $p['version'] && "e" == $p['carrier']) || "3" == $p['version'] || "w" == $p['carrier'] || "g" == $p['carrier'])){
$template->setCurrentBlock('__ShowImage__');
if(file_exists($img_path)){
$template->setVariable('recipe_image',sprintf("
",str_replace(KTY_SERVER_ROOT,"",$img_path)));
}
$template->parseCurrentBlock();
$template->setCurrentBlock('__TopRecipe__');
$template->setVariable('rcp_no',$sweets_top['today'][0]['uniq_id']);
$template->setVariable('title',$sweets_top['today'][0]['rcp_nm']);
$template->parseCurrentBlock();
}
// 2008.03.17 J.Nikaido Chg
//- 10件分を取得
//for($i=0;$isetCurrentBlock('__RecipeList__');
$template->setVariable('rcp_id',$sweets_list[$i]['rcp_no']);
$template->setVariable('title',$sweets_list[$i]['rcp_nm']);
$img_f = sprintf("%s_n-s.jpg",$sweets_list[$i]['rcp_no']);
$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();
}
$template->setVariable('genre_name_top',$sweets_genre[0]['r_gnr_nm']);
$template->setVariable('genre_name_recomend',$sweets_genre[0]['r_gnr_nm']);
$template->setVariable('genre_name_list',$sweets_genre[0]['r_gnr_nm']);
$template->setVariable('contents_top',SWEETS_NAME);
$template->setVariable('site_top',SITE_NAME);
//- ページ送り処理 (Prev)
if('1' < $p['page']){
$template->setCurrentBlock('__PagePrev__');
$template->setVariable('id',$p['id']);
$template->setVariable('prev_page',$p['page'] - 1);
$template->parseCurrentBlock();
}
//- ページ送り処理 (Next)
if(($p['page'] * $show_line) < $list_ct){
$template->setCurrentBlock('__PageNext__');
$template->setVariable('id',$p['id']);
$template->setVariable('next_page', $p['page'] + 1);
$template->parseCurrentBlock();
}
$template->show();
cs4_close($this->db);
}
sweets_list( $p );
?>