db = cs4_open(); //野菜の配列作成 $vegetable_list = array( '101' => 'トマト', '102' => 'キャベツ', '103' => 'ニンジン', '104' => 'タマネギ', '105' => 'ピーマン', '106' => 'ダイコン', '107' => 'ホウレンソウ', '108' => 'ナス', '109' => 'カボチャ', '110' => 'イモ類', '111' => 'キノコ類' ); //変数の初期化 $title = ""; $tmp_key = ""; $terms = $p; //該当条件レシピ一覧を取得 $rcp_list = search_getRcpList($this->db,$terms); //野菜検索情報取得処理 if(empty($terms['vegetable'])){ if(!empty($terms['pre_terms']['vegetable'])){ $tmp_key = array('name' => 'vegetable','phrase' => sprintf("・野菜:%s",$vegetable_list[urldecode($terms['pre_terms']['vegetable'])])); } }else{ $tmp_key = array('name' => 'vegetable','phrase' => sprintf("・野菜:%s",$vegetable_list[urldecode($terms['vegetable'])])); } //検索条件に野菜を選択された場合はkeyphrase変数に取得 if(!empty($tmp_key)){ $keyphrase[] = $tmp_key; } //調理法検索情報取得処理 if(!empty($terms['cook']) && '0' != $terms['cook']){ $cook = bsc_get_rcp_howto_cook($this->db,$terms['cook']); $tmp_key = array('name' => 'cook','phrase' => sprintf("・調理法:%s",$cook)); $keyphrase[] = $tmp_key; } //ページ番号セット $terms['page'] = (empty($terms['page'])) ? "1" : $terms['page'] ; $count = ($rcp_list['list']) ? count($rcp_list['list']) : false ; if(constant('RECIPE_DEBUG_MODE')){ print "
-------------------
bh_recipe_search.php L178 Count -> "; var_dump($count); } //テンプレート読み込み $template =& loadTemplate( $p ); //Keyphrase(検索条件)表示 for($i=0;$isetCurrentBlock('__SearchKey__'); $template->setVariable('keyphrase',$keyphrase[$i]['phrase']); $template->parseCurrentBlock(); } //検索エラー表示 if($count){ $template->setCurrentBlock('__SerachResult__'); $template->setVariable('count',$count); $template->parseCurrentBlock(); $template->hideBlock('__SearchError__'); }else{ $template->TouchBlock('__SearchError__'); } //レシピ一覧作成 $start = ($terms['page'] - 1) * constant('RCP_LIST_COUNT'); $limit = (($start + constant('RCP_LIST_COUNT')) > $count) ? $count : $start + constant('RCP_LIST_COUNT'); $add_param = ""; for($i=0;$isetCurrentBlock('__RecipeList__'); $template->setVariable('url',$detail_url); $template->setVariable('rcp_name',$rcp_list['list'][$i]['rcp_nm']); $template->parseCurrentBlock(); } //サーチエラー処理 if(1 > $count){ switch($terms['mode']){ case "words": $template->TouchBlock('__SearchWords__'); break; case "ing": $template->TouchBlock('__SearchIng__'); break; case "calorie": $template->TouchBlock('__SearchCalorie__'); break; case "style": $template->TouchBlock('__SearchStyle__'); break; case "quick": default: break; } } $key_str = ""; if($terms['page'] > '1'){ $template->setCurrentBlock('__PagePrev__'); $template->setVariable('prev_page',($terms['page'] - 1)); $template->setVariable('page_mode_pre',$terms['mode']); switch($terms['mode']){ case "mix_search": for($i=0;$isetVariable('terms',$key_str); break; default: break; } $template->parseCurrentBlock(); }else{ $template->hideBlock('__PagePrev__'); } if($count > $limit){ $template->setCurrentBlock('__PageNext__'); $template->setVariable('next_page',($terms['page'] + 1)); $template->setVariable('page_mode_next',$terms['mode']); switch($terms['mode']){ case "mix_search": for($i=0;$isetVariable('terms',$key_str); break; default: break; } $template->parseCurrentBlock(); }else{ $template->hideBlock('__PageNext__'); } //- pre_terms を一旦消去 $terms['pre_terms'] = ""; if(!$count || '0' == $count){ $terms = ""; } $template->parseCurrentBlock(); //テンプレート表示 $template->show(); //DB開放 cs4_close($this->db); } vegetable_list( $p ); ?>