최근게시물이 하나만 출력되는 문제 (2개이상 게시판에서 게시물 뽑을경우) > 그누4 질문답변

그누4 질문답변

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

최근게시물이 하나만 출력되는 문제 (2개이상 게시판에서 게시물 뽑을경우) 정보

최근게시물이 하나만 출력되는 문제 (2개이상 게시판에서 게시물 뽑을경우)

본문

* 사용중인 최근게시물 스킨 :
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=81346


* latest.skin.php내용ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//한 줄에 출력할 이미지 개수
$arr_new_cols=5;
?>

<table border="0" align="left" cellpadding="0" cellspacing="0">
  <tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<?
    //한 줄에 $arr_new_cols 만큼 출력
    if($i%$arr_new_cols == 0 && $i>0)
echo "</tr><tr>";

    $content = cut_str(get_text($list[$i][wr_content]), 80);
    $bo_table=$board_list[$i][bo_table];

    $img = "$g4[path]/data/file/$bo_table/thumb/".$list[$i][wr_id];

    if(!$img) //썸네일이 없으면 0번째 이미지를 사용
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);

    if (!file_exists($img)) {
        $img = "$latest_skin_path/img/no_image.gif";
    }

?>
    <td width="111"><table width="111" height="112" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" style="background:url(/images/main/case_bg05.gif) no-repeat; padding-left:1px; padding-top:1px;"><a href="<?=$list[$i]['href']?>"><img src="<?=$img?>" width="107" height="80"></a></td>
      </tr>
      <tr>
        <td height="28" align="center"><a href="<?=$list[$i]['href']?>"><?=nl2br(cut_str(strip_tags($list[$i]['subject']), 17, '..'))?></a></td>
      </tr>
    </table></td>
    <? if($i < (count($list) - 1)){ ?>
    <td width="9"></td>
    <? } } ?>
  </tr>
</table>


* arr_new.lib.php 내용 ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
<?
if (!defined('_GNUBOARD_')) exit;
/*------------------------------------------------------------------------------------------------
  배열을 이용해 특정 게시판에서 최신글 뽑아오기 - 라이브러리
  작성자 : 휴온 박성광
  수정일 : 2008.10.02
  http://www.huon.kr
------------------------------------------------------------------------------------------------*/

// 최신글 추출
function arr_new($skin_dir="", $board_arr=array(), $rows=5, $subject_len=50, $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]' ");

    //기타 설정
    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'];

    $list[$i]['icon_secret'] = "";
    if (strstr($list[$i]['wr_option'], "secret"))
        $list[$i]['icon_secret'] = "<img src='$latest_skin_path/img/icon_secret.gif' align='absmiddle'>";

    $list[$i]['datetime'] = substr($list[$i]['wr_datetime'],0,10);
    $list[$i]['datetime2'] = $list[$i]['wr_datetime'];

    if ($list[$i]['datetime'] == $g4['time_ymd'])
        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],11,5);
    else
        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],5,5);

    }

    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.lib.php");
//검색할 게시판 $bo_table명을 배열에 저장
$board_arr=array("case01_01", "case01_02", "case01_03", "case01_04");
echo arr_new("gallery_", $board_arr, 5, 50);//갤러리형 최신글 출력
?>



메인에서 위의 스킨을 이용해 4개의 게시판을 하나로 불러올려고 합니다.
다른 스킨도 똑같이 보이는걸 보면 스킨 문제는 아닌거 같은데,
무엇이 문제인지 부탁드립니다~

댓글 전체

소스를 봣는데요.... 최신글 소스라기 보다는
글 쓸때 들어가는 xxxx_new 테이블에서 해당 보드아이디를 불러서 뽑아오는 방식 입니다.

즉 xxxx_new 테이블에 있는 데이터가 삭제된다면, 아마 목록 안나올꺼 같구요.
스킨도 하나만 나올껍니다... 여러개 동작 안하구요 :)
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT