작성자만 자기글 보기에서.. 하나만 더 문의드리겠습니다^^;;; > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

작성자만 자기글 보기에서.. 하나만 더 문의드리겠습니다^^;;; 정보

작성자만 자기글 보기에서.. 하나만 더 문의드리겠습니다^^;;;

본문

게시판에 작성자만 자기글 보기를 해서 사용하고 있습니다..

게시물이 많아질시에.. 검색창에 자기가 쓴글에서 자기글만 검색되게 해야하는데,

검색자체가 안되는데, 어떻게 해야 할까요?

아래는.. list.skin.php 의 내용중..

작성자만 자기글 보게끔 해놓은 내용입니다.






//$bb_table_name = 'g4_write_'.$board[bo_table];

// 공지가져오기
$noticeNumS = str_replace("\n",",",$board[bo_notice]);
$bb_query2 = "select * from `{$write_table}` where 1 and find_in_set(wr_id,'{$noticeNumS}') and wr_is_comment != 1 order by  wr_num, wr_reply;";
$result2 = sql_query($bb_query2);
$list2A = array();
while ($row = sql_fetch_array($result2))
{
$row = get_list($row, $board, $g4[path].'/skin/board/'.$board[bo_skin], $board[bo_subject_len]);
array_push($list2A, $row);
}

// 해당 사용자가 쓴 글의 번호를 얻어 옴.
$bb_query1 = "select * from `{$write_table}` where 1 and mb_id like '{$member[mb_id]}'";

$result1 = sql_query($bb_query1);
$list1A = array();
while ($row = sql_fetch_array($result1))
{
$list1S = $row[wr_num].",".$list1S;
//array_push($list1A, $row[wr_num]);
}

// 페이징 처리
$bb_query_total = "select * from `{$write_table}` where 1 and find_in_set(wr_num,'{$list1S}') and wr_is_comment != 1 order by  wr_num, wr_reply;";
$bb_result_total = sql_query($bb_query_total);
$bb_total_count = mysql_num_rows($bb_result_total);

$bb_total_page  = ceil($bb_total_count / $board[bo_page_rows]);  // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$bb_from_record = ($page - 1) * $board[bo_page_rows]; // 시작 열을 구함

$bb_url = "./board.php?bo_table={$board[bo_table]}&page=";
$bb_write_pages = get_paging( $board[bo_page_rows], $page, $bb_total_page, $bb_url, $add="");

// 공지글, 해당사용자가 쓴 글과 관련된 게시물 가져오기
$bb_query3 = "select * from `{$write_table}` where 1 and find_in_set(wr_num,'{$list1S}') and wr_is_comment != 1 order by  wr_num, wr_reply limit $bb_from_record, $board[bo_page_rows];";
$result3 = sql_query($bb_query3);
$list3A = array();
while ($row = sql_fetch_array($result3))
{
$row = get_list($row, $board, $g4[path].'/skin/board/'.$board[bo_skin], $board[bo_subject_len]);
array_push($list2A, $row);
}

if ( !$is_admin) {
$total_count = $bb_total_count;
$list = $list2A;
  $write_pages = $bb_write_pages;
}
  • 복사

댓글 전체

list.skin.php에서 이런 코드로 자기글만 가져 오도록 하는것은 서버 부하면에서 아주 안좋은 방법입니다
왜냐하면 bbs/list.php에서 게시물 리스트를 추출 다 해놓있는데 무시하고 다시 쿼리를 해오니
쓸데 없는쿼리를 한 번 더 하는 것이니까요
10명이 접속한다면 10번 쿼리를 해서 리스트를가져오면 될 것을  20번 쿼리를 해서 리스트를 만든다는
것 아닙니까
한번 이라도 쿼리를 줄이려고 하는 판에...
그리고 이 소스에 검색코드를 집어 넣는 것도 복잡한 일이구요

이런 경우 좋은 방법은
bbs/list.php를 list1.php 로 화일명을 바꾸세요
자기글만 추출해오는 소스는 list1.php를 복사해서 list2.php를 만들고
list2.php에서 자기글만 추출하도록 수정하면 간단히 해결되죠

그리고 list.php는 이렇게 만듭니다
<?
if($bo_table=="자기글만 보는 게시판명1" || $bo_table=="자기글만 보는 게시판명2")
include("list2.php");
else include("list1.php");
?>
답변 감사드립니다만...

list.php 를 list1.php 로 만들고..

<?
if($bo_table=="자기글만 보는 게시판명1" || $bo_table=="자기글만 보는 게시판명2")
include("list2.php");
else include("list1.php");
?>

 위 내용은..

list.php 로 저장하고..

원래 list.php 안의 내용을 list2.php 로 만들라는건지요?;;

이해가 잘 안되는데,, 다시한번 답변 부탁드리겠습니다..ㅠ
© SIRSOFT
현재 페이지 제일 처음으로