테스트 사이트 - 개발 중인 베타 버전입니다

그룹내 특정게시물 최신글에 나오게 하기

블루비 11년 전 조회 4,187

그룹내 작성된 게시물엔 wr_1을 이용해서 최신글에 노출이라는 옵션을 넣어 "1"값을 입력하게 해 놓았습니다.

 

최신글에서 나오게 할려면 어떻게 해야하는지 도움 좀 부탁드립니다. ^^

 

 

아래 소스를 이용하고 있습니다.

 

 

 

if (!defined('_GNUBOARD_')) exit;

/*------------------------------------------------------------------------------------------------

  배열을 이용해 특정 게시판에서 최신글 뽑아오기 - 라이브러리

  작성자 : 휴온 박성광

  수정일 : 2008.10.02

  http://www.huon.kr">http://www.huon.kr

------------------------------------------------------------------------------------------------*/

 

// 최신글 추출

function arr_new($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

   $bo_table=$board_arr[$i];

   $qry_bo_search .= "'$bo_table'";

   if($i

   }

$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 "";

 

   $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'] = "";

 

        $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'] = "";

 

   $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;

}

?> 

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

11년 전

성의 있는 답변 너무 감사합니다..

그래도 아직 해결이 안되었네요 ㅠ,ㅠ;;;;

 

arr_new 로 불러오는 곳 마지막에 옵션부분에 true를 적용하고 말씀해주신데로 적용 위치를 바꿨으나 그래도 최근에 입력된 게시물이 모두 나오네요. ㅜ,ㅜ;;

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

11년 전

음... 제가 글을 잘못 읽은것 같네요... 

arr_new를 부를때... arr_new(스킨경로,보드arr,10,40,true) 이런식으로 option을 true상태로 해서 해야 실행이 될겁니다. 

그리고 아래 함수 부분은 다시 변경 했어요. 

36라인 아니고 43라인에 넣어야되는것 같네요. 

 

</span><span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">// 최신글 추출</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">function arr_new($skin_dir="", $board_arr=array(), $rows=10, $subject_len=40, $options="")</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">{</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    global $g4;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>if ($skin_dir)</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $latest_skin_path = "$g4[path]/skin/latest/basic";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $list = array();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $board_list = array();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    //검색조건</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    if(count($board_arr)>0){</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $qry_bo_search=" bo_table in(";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    for($i=0; $i<count($board_arr); $i++) {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    $bo_table=$board_arr[$i];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    $qry_bo_search .= "'$bo_table'";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    if($i<count($board_arr)-1) $qry_bo_search .= ", ";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>$qry_bo_search .= ")";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>} else {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>$qry_bo_search="(1)";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>}</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span style="line-height: 23.5440006256104px;"> </span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span style="line-height: 23.5440006256104px;">   $qry_bo_search2 =" ";</span><span style="line-height: 23.5440006256104px;">​</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    if($option){</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="line-height: 23.5440006256104px; white-space: pre;">	</span><span style="line-height: 23.5440006256104px;"> </span><span style="line-height: 23.5440006256104px;">   $qry_bo_search2 =" and wr_1=1 ";</span> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">   }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>//echo $qry_bo_search;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>//new에서 해당되는 게시판의 최신글 뽑아오기</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $sql = "select bo_table, wr_id from $g4[board_new_table]</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">					</span>where wr_id = wr_parent and $qry_bo_search <span style="line-height: 23.5440006256104px;">order by bn_datetime desc LIMIT 0,$rows";</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>$result = sql_query($sql);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    for ($i=0; $row = sql_fetch_array($result); $i++) {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $bo_table=$row[bo_table];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $write_table=$g4['write_prefix'].$bo_table;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $board_sql = " select * from $g4[board_table] where bo_table = '$bo_table' <span style="line-height: 23.5440006256104px;">$qry_bo_search2</span><span style="line-height: 23.5440006256104px;">​</span><span style="line-height: 23.5440006256104px;">​</span><span style="line-height: 23.5440006256104px;"> "; </span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $board_list[$i]=sql_fetch($board_sql);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]=sql_fetch("select * from $write_table where wr_id='$row[wr_id]' ");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    //기타 설정</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($subject_len)</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $subject_len, "…");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $board_list[$i]['bo_subject_len'], "…");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i][href]="$g4[bbs_path]/board.php?bo_table={$board_list[$i][bo_table]}&wr_id={$list[$i][wr_id]}".$qstr;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    //$list[$i]['is_notice'] = preg_match("/[^0-9]{0,1}{$list[$i]['wr_id']}[\r]{0,1}/", $board_list[$i]['bo_notice']);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['is_notice']=false;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $arr_notice = split("\n", trim($board_list[$i]['bo_notice']));</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if(in_array($list[$i]['wr_id'], $arr_notice)) $list[$i]['is_notice']=true;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    echo "<!--".$board_list[$i]['bo_table']."/".$board_list[$i]['bo_notice']."-->";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['icon_new'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    <span class="Apple-tab-span" style="white-space: pre;">	</span>if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board_list[$i]['bo_new'] * 3600)))</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        <span class="Apple-tab-span" style="white-space: pre;">	</span>$list[$i]['icon_new'] = "<img src='$latest_skin_path/img/icon_new.gif' align='absmiddle'>";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $list[$i]['comment_cnt'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($list[$i]['wr_comment'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['comment_cnt'] = "({$list[$i][wr_comment]})";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>if ($board_list[$i]['bo_use_comment'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $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');";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['comment_href'] = $list[$i]['href'];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['icon_secret'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if (strstr($list[$i]['wr_option'], "secret"))</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['icon_secret'] = "<img src='$latest_skin_path/img/icon_secret.gif' align='absmiddle'>";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['datetime'] = substr($list[$i]['wr_datetime'],0,10);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['datetime2'] = $list[$i]['wr_datetime'];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($list[$i]['datetime'] == $g4['time_ymd'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],11,5);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],5,5);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    ob_start();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    include "$latest_skin_path/latest.skin.php";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $content = ob_get_contents();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    ob_end_clean();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    return $content;</p><p><span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">}</span>

  

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

11년 전

답변 너무 감사합니다.

 

말씀해주신 코드를 적용했는데 해당 그룹의 wr_1값이 1인값만 나오는게 아니고 최근 게시물 전체가 뿌려지네요. 

 

혹, 다른 방법은 없을까요? 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

11년 전

option을 이용해서 아래와 같이 고쳐보는것은 어떨런지요?

 

아래 27~31라인추가 36라인 수정... 입니다.

 

<span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">// 최신글 추출</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">function arr_new($skin_dir="", $board_arr=array(), $rows=10, $subject_len=40, $options="")</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">{</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    global $g4;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>if ($skin_dir)</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $latest_skin_path = "$g4[path]/skin/latest/basic";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $list = array();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $board_list = array();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    //검색조건</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    if(count($board_arr)>0){</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $qry_bo_search=" bo_table in(";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    for($i=0; $i<count($board_arr); $i++) {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    $bo_table=$board_arr[$i];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    $qry_bo_search .= "'$bo_table'";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>    if($i<count($board_arr)-1) $qry_bo_search .= ", ";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>$qry_bo_search .= ")";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>} else {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>$qry_bo_search="(1)";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>}</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span style="line-height: 23.5440006256104px;"> </span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span style="line-height: 23.5440006256104px;">   $qry_bo_search2 =" ";</span><span style="line-height: 23.5440006256104px;">​</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    if($option){</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="line-height: 23.5440006256104px; white-space: pre;">	</span><span style="line-height: 23.5440006256104px;"> </span><span style="line-height: 23.5440006256104px;">   $qry_bo_search2 =" and wr_1=1 ";</span> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">   }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>//echo $qry_bo_search;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>//new에서 해당되는 게시판의 최신글 뽑아오기</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $sql = "select bo_table, wr_id from $g4[board_new_table]</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">					</span>where wr_id = wr_parent and $qry_bo_search <span style="line-height: 23.5440006256104px;">$qry_bo_search2</span><span style="line-height: 23.5440006256104px;">​</span><span style="line-height: 23.5440006256104px;"> order by bn_datetime desc LIMIT 0,$rows";</span></p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>$result = sql_query($sql);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    for ($i=0; $row = sql_fetch_array($result); $i++) {</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $bo_table=$row[bo_table];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $write_table=$g4['write_prefix'].$bo_table;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $board_sql = " select * from $g4[board_table] where bo_table = '$bo_table'";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $board_list[$i]=sql_fetch($board_sql);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]=sql_fetch("select * from $write_table where wr_id='$row[wr_id]' ");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    //기타 설정</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($subject_len)</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $subject_len, "…");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $board_list[$i]['bo_subject_len'], "…");</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i][href]="$g4[bbs_path]/board.php?bo_table={$board_list[$i][bo_table]}&wr_id={$list[$i][wr_id]}".$qstr;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    //$list[$i]['is_notice'] = preg_match("/[^0-9]{0,1}{$list[$i]['wr_id']}[\r]{0,1}/", $board_list[$i]['bo_notice']);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['is_notice']=false;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $arr_notice = split("\n", trim($board_list[$i]['bo_notice']));</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if(in_array($list[$i]['wr_id'], $arr_notice)) $list[$i]['is_notice']=true;</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    echo "<!--".$board_list[$i]['bo_table']."/".$board_list[$i]['bo_notice']."-->";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['icon_new'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    <span class="Apple-tab-span" style="white-space: pre;">	</span>if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board_list[$i]['bo_new'] * 3600)))</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        <span class="Apple-tab-span" style="white-space: pre;">	</span>$list[$i]['icon_new'] = "<img src='$latest_skin_path/img/icon_new.gif' align='absmiddle'>";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">        $list[$i]['comment_cnt'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($list[$i]['wr_comment'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['comment_cnt'] = "({$list[$i][wr_comment]})";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">		</span>if ($board_list[$i]['bo_use_comment'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $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');";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['comment_href'] = $list[$i]['href'];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['icon_secret'] = "";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if (strstr($list[$i]['wr_option'], "secret"))</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['icon_secret'] = "<img src='$latest_skin_path/img/icon_secret.gif' align='absmiddle'>";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['datetime'] = substr($list[$i]['wr_datetime'],0,10);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    $list[$i]['datetime2'] = $list[$i]['wr_datetime'];</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    if ($list[$i]['datetime'] == $g4['time_ymd'])</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],11,5);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>    else</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"><span class="Apple-tab-span" style="white-space: pre;">	</span>        $list[$i]['datetime2'] = substr($list[$i]['datetime2'],5,5);</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    }</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    ob_start();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    include "$latest_skin_path/latest.skin.php";</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    $content = ob_get_contents();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    ob_end_clean();</p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);"> </p><p style="line-height: 23.5440006256104px; word-break: break-all; font-family: gulim, helvetica; background-color: rgb(255, 255, 255);">    return $content;</p><p><span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">}</span>

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인