db = cs4_open(); $terms = $p; $title_arr = array( 'new' => '新着晩ごはんはコチラ!', 'pop' => '今日の人気晩ごはんはコチラ!', ); //var_dump($terms); //ページ番号セット $terms['page'] = (empty($terms['page'])) ? "1" : $terms['page'] ; //---- 該当条件レシピ一覧を取得 //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } if(!empty($p['m_no'])){ //******************************// // 個人投稿リスト取得 // //******************************// $where = sprintf(" post_no = '%s' and pub_flg = 0 and dlt_flg = 0",$p['m_no']); $order = " post_date desc"; $sql = "select uniq_id, post_title, user_nm "; $sql.= sprintf(" from contents_data_tonari_contribute where %s order by %s",$where,$order); $ret = $db->query($sql); if(DB::isError($ret)){ echo "

クエリの送信が失敗しました。

"; exit; } //件数取得 $count = $ret->numRows(); while($row = $ret->fetchRow(DB_FETCHMODE_ASSOC)){ $array[uniq_id][] = $row['uniq_id']; $array[title][] = $row['post_title']; $array[user_nm][] = $row['user_nm']; } } //DB開放 $db->disconnect(); //デバッグ処理 if(constant('BBS_DEBUG_MODE')){ print "
-------------------
bh_recipe_search.php L178 Count -> "; var_dump($count); } // テンプレート読み込み $template =& loadTemplate( $p ); //- 検索エラーハンドリング if($count){ $template->setCurrentBlock('__SerachResult__'); $template->setVariable('count',$count); $template->parseCurrentBlock(); $template->hideBlock('__SearchError__'); }else{ $template->TouchBlock('__SearchError__'); $template->hideBlock('__SearchResult__'); } //-- レシピ一覧作成 $start = ($terms['page'] - 1) * constant('RCP_LIST_COUNT'); $limit = (($start + constant('RCP_LIST_COUNT')) > $count) ? $count : $start + constant('RCP_LIST_COUNT'); //var_dump($rcp_list); for($i = $start;$i < $limit;$i++){ //- Detail url作成 $detail_url = sprintf("tonari_detail.php?p[uniq_id]=%d",$array['uniq_id'][$i]); //$detail_url = sprintf("%d",$array['uniq_id'][$i]); //- ユーザプロフィールリンクurl作成 $user_prof_url = sprintf("userslist/%s",$p['m_no']); $template->setCurrentBlock('__RecipeList__'); $template->setVariable('uniq_id',$array['uniq_id'][$i]); $template->setVariable('rcp_name',$array['title'][$i]); $template->setVariable('user_name',"".$array['user_nm'][$i]); $template->parseCurrentBlock(); } $template->setVariable('title_name',$array['user_nm'][0]); //デバッグ処理 if(constant('BBS_DEBUG_MODE')){ print "
Page Now -> ".$terms['page']."
\n"; print "Total Count -> ".$count."
\n"; print "Show Limit -> ".$limit."
\n"; } $key_str = ""; if($terms['page'] > '1'){ $template->setCurrentBlock('__PagePrev__'); $template->setVariable('prev_page',($terms['page'] - 1)); $template->setVariable('m_no',$p['m_no']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__PagePrev__'); } if($count > $limit){ $template->setCurrentBlock('__PageNext__'); $template->setVariable('next_page',($terms['page'] + 1)); $template->setVariable('m_no',$p['m_no']); $template->parseCurrentBlock(); }else{ $template->hideBlock('__PageNext__'); } $template->setVariable('contents_top',TONARI_NAME); $template->show(); //DB開放 cs4_close($this->db); } //var_dump($p); tonari_userslist( $p ); ?>