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

그룹최신글 정렬 문의드려요~ 채택완료

주봉이 10년 전 조회 3,434

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

먼저 나오게 하고 싶은 값은 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가 아닌값은 나중에 뜨게 하고 싶어서요...

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

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

</p><p><?</p><p>if (!defined('_GNUBOARD_')) exit;
/*------------------------------------------------------------------------------------------------
  배열을 이용해 특정 게시판에서 최신글 뽑아오기 - 라이브러리
  작성자 : 휴온 박성광
  수정일 : 2008.10.02
  <a href="<a href="http://www.huon.kr" target="_blank" rel="noopener noreferrer">http://www.huon.kr</a>"><a href="http://www.huon.kr" target="_blank" rel="noopener noreferrer">http://www.huon.kr</a></a>
------------------------------------------------------------------------------------------------*/</p><p>// 최신글 추출
function arr_new_gallery($skin_dir="", $board_arr=array(), $rows=10, $subject_len=40, $options="")
{
    global $g4;</p><p> if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";</p><p>    $list = array();
    $board_list = array();</p><p>    //검색조건
    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)";
 }</p><p> //echo $qry_bo_search;</p><p> //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";</p><p> $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;</p><p>     $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'], "…");</p><p>     $list[$i][href]="$g4[bbs_path]/board.php?bo_table={$board_list[$i][bo_table]}&wr_id={$list[$i][wr_id]}".$qstr;</p><p>     //$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;</p><p>     echo "<!--".$board_list[$i]['bo_table']."/".$board_list[$i]['bo_notice']."-->";</p><p>     $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'>";</p><p>        $list[$i]['comment_cnt'] = "";
     if ($list[$i]['wr_comment'])
         $list[$i]['comment_cnt'] = "({$list[$i][wr_comment]})";</p><p>  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'];</p><p>     $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'>";</p><p>     $list[$i]['datetime'] = substr($list[$i]['wr_datetime'],0,10);
     $list[$i]['datetime2'] = $list[$i]['wr_datetime'];</p><p>     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']);
    }</p><p>    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();</p><p>    return $content;
}
?>​</p><p><strong>

 

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

답변 1개

 </p><p>function arr_new_gallery($skin_dir="", $board_arr=array(), $rows=10, $subject_len=40, $options="")</p><p>{</p><p>    global $g4;</p><p> if ($skin_dir)</p><p>        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";</p><p>    else</p><p>        $latest_skin_path = "$g4[path]/skin/latest/basic";</p><p>    $list = array();</p><p>    $board_list = array();</p><p>    //검색조건</p><p>    if(count($board_arr)>0){</p><p>     $qry_bo_search=" bo_table in("; // bo_table 안에 라는 조건이구요.</p><p>     for($i=0; $i<count($board_arr); $i++) { // 입력하신 board_arr의 갯수만큼 for문을 돌려서요</p><p>      $bo_table=$board_arr[$i];</p><p>      $qry_bo_search .= "'$bo_table'"; // qry_bo_search에 저장을해요. 이게 위에 bo_table안에 들어가는 조건이구요.</p><p>      if($i<count($board_arr)-1) $qry_bo_search .= ", ";</p><p>     }</p><p>  $qry_bo_search .= ")";</p><p> } else {</p><p>  $qry_bo_search="(1)";</p><p> }</p><p> //echo $qry_bo_search;</p><p> //new에서 해당되는 게시판의 최신글 뽑아오기</p><p>    $sql = "select bo_table, wr_id from $g4[board_new_table]</p><p>     where wr_id = wr_parent and $qry_bo_search order by bn_datetime desc LIMIT 0,$rows"; // 여기서 검색할때 bn_datetime순으로 검색하는걸 수정하시거나 추가하시면 될것같네요~ </p><p>

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

답변에 대한 댓글 1개

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

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

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

로그인