그룹 최근게시물 추출시... > 그누4 질문답변

그누4 질문답변

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

그룹 최근게시물 추출시... 정보

그룹 최근게시물 추출시...

본문

안녕하세요?
그룹최근게시물 중에서 관리자가 체크한 것만 보이게하려면 어찌해야하나요?

// 최신글 추출
function arr_new_gallery($skin_dir="", $board_arr=array(), $rows=10, $subject_len=40, $options="")
{
    global $g4;

if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";

    $list = array();
    $board_list = array();

    //검색조건
    if(count($board_arr)>0){
    $qry_bo_search=" bo_table in(";
    for($i=0; $i<count($board_arr); $i++) {
    $bo_table=$board_arr[$i];
    $qry_bo_search .= "'$bo_table'";
    if($i<count($board_arr)-1) $qry_bo_search .= ", ";
    }
$qry_bo_search .= ")";
} else {
$qry_bo_search="(1)";
}

//echo $qry_bo_search;

//new에서 해당되는 게시판의 최신글 뽑아오기
    $sql = "select bo_table, wr_id from $g4[board_new_table]
where wr_id = wr_parent and $qry_bo_search order by bn_datetime desc LIMIT 0,$rows";

$result = sql_query($sql);
    for ($i=0; $row = sql_fetch_array($result); $i++) {
    $bo_table=$row[bo_table];
    $write_table=$g4['write_prefix'].$bo_table;

    $board_sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
    $board_list[$i]=sql_fetch($board_sql);
        $list[$i]=sql_fetch("select * from $write_table where wr_id='$row[wr_id]' ");
   
//파일 뽑기
        //$img_file_info = "select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$row[wr_id]' and bf_no = 0";
               
// 이미지 정보 가져오기
//$list[$i]['file'] =$img_file_info;
        $list[$i]['file'] = get_file($board_list[$i][bo_table], $list[$i][wr_id]);
       
        //기타 설정
    if ($subject_len)
        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $subject_len, "…");
    else
        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $board_list[$i]['bo_subject_len'], "…");

    $list[$i][href]="$g4[bbs_path]/board.php?bo_table={$board_list[$i][bo_table]}&wr_id={$list[$i][wr_id]}".$qstr;

    //$list[$i]['is_notice'] = preg_match("/[^0-9]{0,1}{$list[$i]['wr_id']}[\r]{0,1}/", $board_list[$i]['bo_notice']);
    $list[$i]['is_notice']=false;
    $arr_notice = split("\n", trim($board_list[$i]['bo_notice']));
    if(in_array($list[$i]['wr_id'], $arr_notice)) $list[$i]['is_notice']=true;

    echo "<!--".$board_list[$i]['bo_table']."/".$board_list[$i]['bo_notice']."-->";

    $list[$i]['icon_new'] = "";
    if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board_list[$i]['bo_new'] * 3600)))
        $list[$i]['icon_new'] = "<img src='$latest_skin_path/img/icon_new.gif' align='absmiddle'>";

        $list[$i]['comment_cnt'] = "";
    if ($list[$i]['wr_comment'])
        $list[$i]['comment_cnt'] = "({$list[$i][wr_comment]})";

if ($board_list[$i]['bo_use_comment'])
        $list[$i]['comment_href'] = "javascript:win_comment('$g4[bbs_path]/board.php?bo_table=$board_list[$i][bo_table]&wr_id=$list[$i][wr_id]&cwin=1');";
    else
        $list[$i]['comment_href'] = $list[$i]['href'];

    }

    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
?>

  <?
    include_once("$g4[path]/lib/arr_new_gallery.lib.php");
  $board_arr=array('people','issue','interview','opinion','edustory');//여기에 테이블 계속추가
echo arr_new_gallery("group", $board_arr, 6,45,2);//arr_new_gallery ?>
                  </div>

이 소스로 그룹 최근게시물은 추출했는데 관리자가 체크한것만 보이게 하는건 어찌하는지 잘 모르겠습니다. 고수님들 좀 알려주세요~ 초보는 넘 어렵네요.. ㅠㅠ
  • 복사

댓글 전체

제가 이해를 했는지 모르겠지만.

//new에서 해당되는 게시판의 최신글 뽑아오기
    $sql = "select bo_table, wr_id from $g4[board_new_table]
where wr_id = wr_parent and $qry_bo_search order by bn_datetime desc LIMIT 0,$rows";

이부분에 where절에 추가하면 될 듯 할텐데요. 체크된 필드 검색.


//new에서 해당되는 게시판의 최신글 뽑아오기
    $sql = "select bo_table, wr_id from $g4[board_new_table]
where wr_id = wr_parent and $qry_bo_search and 추가한필드 = '체크' order by bn_datetime desc LIMIT 0,$rows";
© SIRSOFT
현재 페이지 제일 처음으로