그룹최신글 정렬 문의드려요~

그룹최신글 정렬 문의드려요~

QA

그룹최신글 정렬 문의드려요~

본문

안녕하세요~ 그룹최신글 정렬 문의 드릴라구요~

먼저 나오게 하고 싶은 값은 wr_40='y'

이건데요~

일반 최신글은 lastst.lip에서 이렇게 하면 잘 되더라구요..(요 아래한줄처럼요)

$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_40='y' limit 0, $rows ";

 

그런데요~

그룹 최신글스킨을 사용중이거든요~

메인에서 불러오는 방식은요

 

<? //최신 앨범 라이브러리
include_once("$g4[path]/lib/arr_new_gallery.lib.php");
//검색할 게시판 $bo_table명을 배열에 저장
$board_arr=array('sky_car','top_wing','ladder','cargo_truck');//여기에 테이블 계속추가
echo arr_new_gallery("Group_skin", $board_arr, 4,15,4);//arr_new_gallery("스킨명", $board_arr, 노출될 최신글 총갯수,노출글자수,가로갯수);
?>​

 

요고구요~

arr_new_gallery.lib.php  의 소스는요~ 요 아래 부터인데요~

어디를 수정해야 wr_40='y'  의 값이 먼저 뜰까요..y가 아닌값은 나중에 뜨게 하고 싶어서요...

꼬옥 좀 봐주세요... 팁이라도 주심 매우 감사감사 하겠습니당~^^

----------------------------------------------------------------------------------------------


<?
if (!defined('_GNUBOARD_')) exit;
/*------------------------------------------------------------------------------------------------
  배열을 이용해 특정 게시판에서 최신글 뽑아오기 - 라이브러리
  작성자 : 휴온 박성광
  수정일 : 2008.10.02
  http://www.huon.kr
------------------------------------------------------------------------------------------------*/
// 최신글 추출
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'];
     $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);
  // 삭제할 코드 
        //$list[$i]['file'] = get_file($bo_table, $list[$i]['wr_id']);
    }
    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
?>​

 

이 질문에 댓글 쓰기 :

답변 1

 
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("; // bo_table 안에 라는 조건이구요.
     for($i=0; $i<count($board_arr); $i++) { // 입력하신 board_arr의 갯수만큼 for문을 돌려서요
      $bo_table=$board_arr[$i];
      $qry_bo_search .= "'$bo_table'"; // 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"; // 여기서 검색할때 bn_datetime순으로 검색하는걸 수정하시거나 추가하시면 될것같네요~ 

답변감사해요~ 그런데요~
코드 추가를 어찌하는지 모르겠습니당..
이렇게 저렇게 해봐도. 프로그램을 잘 몰라서 에러만 자꾸나요..ㅠㅠ
for문 한번더 반복하고
$sql = 이부분도 한번더 써서 해봤는데 안됩니당..ㅠㅠ

답변을 작성하시기 전에 로그인 해주세요.
전체 20
QA 내용 검색

회원로그인

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