query($sql); if(DB::isError($res)){ echo "

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

"; exit; } //件数取得 $num = $res->numRows(); // テンプレート読み込み $template =& loadTemplate( $p ); //- ranking $i = 1; if(!empty($num)){ $template->setCurrentBlock('__RankingPeriod__'); $template->setVariable('split_date',$str_period); $template->parseCurrentBlock(); while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)){ //顧客情報からニックネーム取得 $user_detail = rcp_get_UserDetail($db,$row['post_no']); $id = $row['post_no']; if($i < 4){ //$where = sprintf(" post_no = '$s' and pub_flg = 0 and dlt_flg = 0 ",$row['post_no']); $where = " post_no = ".$row['post_no']." and pub_flg = 0 and dlt_flg = 0 "; $order = " post_date desc limit 0,1"; $from = " contents_data_tonari_contribute"; $sql = "select post_date, post_img, post_title, uniq_id "; $sql .= sprintf(" from %s where %s order by %s",$from,$where,$order); $res = $db->query($sql); if(DB::isError($res)){ echo "

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

"; exit; } while($img = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $template->setCurrentBlock('__ImageLink__'); //画像パス取得 // $img_path = sprintf("/home/www/public/image/tonari/%s",$img['uniq_id']); //画像表示処理 // if(!empty($img['uniq_id'])){ // $template->setVariable('image_id',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); // } $template->setVariable('uniq_id',$img['uniq_id']); $template->setVariable('image_id',$img['post_img']); $template->setVariable('title',$img['post_title']); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__List__'); if($i == 1){ $template->setVariable('rank'," ".$i); }else{ $template->setVariable('rank',$i); } $template->setVariable('m_no',$row['post_no']); $template->setVariable('nick_nm',$user_detail['mem_nick_nm']); $template->parseCurrentBlock(); $i++; } } switch($p['r_id']){ case "m": $template->TouchBlock('__Title_M__'); $template->TouchBlock('__HeaderLinkW__'); $template->TouchBlock('__FooterLinkW__'); break; case "w": $template->TouchBlock('__Title_W__'); $template->TouchBlock('__HeaderLinkM__'); $template->TouchBlock('__FooterLinkM__'); break; } $template->show(); } tonari_rank( $p ); ?>