검색결과 후 검색된 리스트에 그룹명 추출 및 3단 정렬 정보
검색결과 후 검색된 리스트에 그룹명 추출 및 3단 정렬관련링크
본문
일반적으로 검색을 하게되면 검색 결과페이지에서 검색된 (board)리스트가 일렬로 나옵니다.
또한 게시판명과 함께 검색된 검색수가 나오지만, 해당 그룹명은 추출이 안되지요.^^;
위와 같은 면이 조금 불편해서 바꿔봤습니다. 첨부된 이미지와 링크주소가 미리보기 이구요.
수정방법은 간단합니다. /bbs/search.php 파일을 여시고~
아래와 같이 수정전 소스를 수정후 소스로 바꿔보세요.(사용된 이미지는 사이트에 맞게끔 수정하세요.^^)
-- 수정전 -- (대략 115번째줄)
$str_board_list = "";
$board_count = 0;
$time1 = get_microtime();
$total_count = 0;
for ($i=0; $i<count($g4_search[tables]); $i++)
{
$tmp_write_table = $g4[write_prefix] . $g4_search[tables][$i];
$sql = " select wr_id from $tmp_write_table where $sql_search ";
$result = sql_query($sql, false);
$row[cnt] = @mysql_num_rows($result);
//$sql = " select count(*) as cnt from $tmp_write_table where $sql_search ";
//$row = sql_fetch($sql);
$total_count += $row[cnt];
if ($row[cnt])
{
$board_count++;
$search_table[] = $g4_search[tables][$i];
$read_level[] = $g4_search[read_level][$i];
$search_table_count[] = $total_count;
$sql2 = " select bo_subject from $g4[board_table] where bo_table = '{$g4_search[tables][$i]}' ";
$row2 = sql_fetch($sql2);
$str_board_list .= "<li><a href='$_SERVER[PHP_SELF]?$search_query&gr_id=$gr_id&onetable={$g4_search[tables][$i]}'>$row2[bo_subject]</a> ($row[cnt])";
}
}
-- 수정후 --
$str_board_list = "\n<table width=770 cellpadding='0' cellspacing='0' style='border-width:1; border-color:silver; border-style:dashed;'><tr><td><table width='100%' height='100%' border='0' cellpadding='0' cellspacing='4' bgcolor='F5F5F5'><tr><td align='center' valign='top' bgcolor='#FFFFFF' style='padding:0px'><table width='100%' border='0' cellspacing='3' cellpadding='0'><tr><td height='6'>"; // 이테이블이 리스트한줄로 나오던것을 세줄로 나오도록 하는 테이블입니다
$board_count = 0;
$time1 = get_microtime();
$total_count = 0;
for ($i=0; $i<count($g4_search[tables]); $i++)
{
$tmp_write_table = $g4[write_prefix] . $g4_search[tables][$i];
$sql = " select wr_id from $tmp_write_table where $sql_search ";
$result = sql_query($sql, false);
$row[cnt] = @mysql_num_rows($result);
$total_count += $row[cnt];
if ($row[cnt])
{
$num_rows = 3; // 한줄에 보일 리스트수
$width_per = (int)(100 / $num_rows);
$board_count++;
$search_table[] = $g4_search[tables][$i];
$read_level[] = $g4_search[read_level][$i];
$search_table_count[] = $total_count;
$sql2 = " select bo_subject, gr_id from $g4[board_table] where bo_table = '{$g4_search[tables][$i]}' ";
$row2 = sql_fetch($sql2);
$gr2 = get_group($row2[gr_id]);
$mod_board_count = $board_count%$num_rows;
if($mod_board_count == "1")
$str_board_list .= "<tr>\n";
$str_board_list .= "<td width=256 valign=top height='22' align='left'>";
$str_board_list .= " <img src='http://www.sir.co.kr/img/public/navi_f2.gif'> {$gr2[gr_subject]} > <a href='$_SERVER[PHP_SELF]?$search_query&gr_id=$gr_id&onetable={$g4_search[tables][$i]}' onfocus='this.blur()'><font color='#1425D0'><u>$row2[bo_subject]</u></font> <font color='#578FBF'>($row[cnt])</font></a>";
}
}
$str_board_list .= "</td>";
if($mod_co == "0") {
$str_board_list .= "</tr>";
}
while($mod_board_count > 0) {
$board_count++;
$mod_board_count = $board_count%$num_rows;
if($mod_board_count == "1")
$str_board_list .= "<tr>";
$str_board_list .= "<td width='$width_per%' align='center'></td>";
if($mod_board_count == "0")
$str_board_list .= "</tr>";
}
$str_board_list .= "</table></td></tr></table></td></tr></table>\n";
5
댓글 13개

수고하셨습니다...^^
스크랩해갑니다~^^


