require_once('../prepare.php');
function nb_sweets_list( $p )
{
//- スウィーツcsv取得
$csv_file = (!empty($p['gid'])) ? sprintf("sweets_%d",$p['gid']) : "sweets_top";
$csv_sweets_top = get_csvdata( $csv_file );
$this->db = cs4_open();
//- 写真付き日替わりレシピ取得
$sweets_top = get_rcpList($this->db, $csv_sweets_top);
$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['gid']);
//- 該当ジャンルのレシピ一覧取得
$sweets_list = get_SweetsRecipe($this->db, $p['gid'] );
// テンプレート読み込み
$template =& loadTemplate( $p );
// 食べた日付取得
$date = (isset($p['date'])) ? $p['date']:$p['eat_ymd'];
if(!empty($sweets_top['today'][0]) && (("2" == $p['version'] && "i" == $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('ymd_arg',$date);
$template->setVariable('type_arg',$p['type']);
$template->setVariable('gid_arg',$p['gid']);
$template->setVariable('title',$sweets_top['today'][0]['rcp_nm']);
$template->parseCurrentBlock();
}
for($i=0;$isetCurrentBlock('__RecipeList__');
$template->setVariable('rcp_id',$sweets_list[$i]['rcp_no']);
$template->setVariable('ymd_arg',$date);
$template->setVariable('type_arg',$p['type']);
$template->setVariable('gid_arg',$p['gid']);
$template->setVariable('title',$sweets_list[$i]['rcp_nm']);
$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',NOTEBOOK_NAME);
$template->setVariable('site_top',SITE_NAME);
$template->show();
cs4_close($this->db);
}
nb_sweets_list( $p );
?>