db = cs4_open(); $this->user = u4user_open(); $unit = get_unit($this->db); // 1ページの表示数(favor_delete.phpにも同様の表示数を書くこと!!) $show_line = 10; // お気に入りレシピの登録件数を確認 $where = sprintf("car_no='%s' and p_knd = 2 and list_dlt=0", $p['uid']); $num = cs4_num_rows($this->db,"bsc_list",$where); $p['page'] = (!empty($p['page']) && '0' < $p['page']) ? $p['page'] : '1'; $where = ""; $where .= sprintf(" car_no='%s' and list_dlt=0 and p_knd=2 and p_no is not null ", $p['uid']); $ct = 0; $ct = cs4_num_rows($this->db,'bsc_list',$where); if($ct){ $ret=cs4_select($this->db,"bsc_list",$where); while($row = cs4_fetch_row($ret)) { //↓のクラスを使うと遅いので直接データを呼び出すために削除 //$tmp_favor = ""; //$tmp_favor = get_rcpDetail_L($this->db, $row['p_no']); //レシピデータを抽出 $where2 = ""; $where2 .= sprintf(" rcp_dlt = 0 and rcp_no = %d ", $row['p_no']); $rs = cs4_select($this->db, "bsc_r_new", $where2); $row2 = cs4_fetch_row($rs); //if(!empty($tmp_favor)){ if(!empty($row2)){ //$favor_arr[] = get_rcpDetail_L($this->db, $row['p_no']); $favor_arr[][0] = $row2; } } } $ct = count($favor_arr); if(!$ct || $ct == "0"){ $template->hideBlock('__RecipeList__'); $template->TouchBlock('__NoRecipe__'); }else{ $template->hideBlock('__NoRecipe__'); $cnt = 0; for($i=($p['page'] - 1) * $show_line;$i < ($p['page'] * $show_line) && $i < $ct && !empty($favor_arr[$i][0]['uniq_id']);$i++){ if('1' != $p['version'] && ('i' == $p['carrier'] || 'v' == $p['carrier'])){ $thumbnail_path = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$favor_arr[$i][0]['uniq_id']); if(file_exists($thumbnail_path)){ $template->setCurrentBlock('__ShowImage__'); $template->setVariable('img_src',sprintf("/image/recipe/%s_n-thm.jpg",$favor_arr[$i][0]['uniq_id'])); $template->parseCurrentBlock(); } } clearstatcache(); $template->setVariable('rcp_count',$num); $template->setCurrentBlock('__RecipeList__'); $template->setVariable('rcp_cnt',$cnt); $template->setVariable('rcp_no',$favor_arr[$i][0]['uniq_id']); $template->setVariable('title',$favor_arr[$i][0]['rcp_nm']); if(!empty($favor_arr[$i][0]['rcp_kind'])){ $template->setVariable('genre',$favor_arr[$i][0]['rcp_kind']); } $template->parseCurrentBlock(); $cnt ++; } } //- ページ送り処理 (Prev) if('1' < $p['page']){ $template->setCurrentBlock('__PagePrev__'); $template->setVariable('prev_page',$p['page'] - 1); $template->parseCurrentBlock(); } //- ページ送り処理 (Next) if(($p['page'] * $show_line) <= $ct){ $template->setCurrentBlock('__PageNext__'); $template->setVariable('next_page', $p['page'] + 1); $template->parseCurrentBlock(); } // uidからニックネームを取得 $user_data = u4user_select_one($this->user,"car_no=\"".$p['uid']."\""); // $template->setVariable('nick_name',$user_data['mem_nick_nm']); $template->setVariable('change_url',SSL_PROTO.DOMAIN_NAME."/my/prof_input.php?p[u_id]=".$p['uid']."&p[act]=update&p[contents]=my_rcp"); $template->show(); cs4_close($this->db); u4user_close($this->user); } favor_list($p); ?>