최근게시물문제인데요...하나는 해결했는데 한개는 해결이 안됬어요... > 그누4 질문답변

그누4 질문답변

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

최근게시물문제인데요...하나는 해결했는데 한개는 해결이 안됬어요... 정보

최근게시물문제인데요...하나는 해결했는데 한개는 해결이 안됬어요...

본문

질문 주고 받은 내용입니다. 부탁드리겠습니다. 전재산 올인해요...TT;
  특정 그룹을 최근게시물에서 안보이게 할려면 어떻게 해요?   icon_select.gif
  글쓴이 : 잘몰라 (220.♡.171.178)     날짜 : 07-03-30 14:51     조회 : 26     포인트 : 500점    
  트랙백 주소 : http://sir.co.kr/bbs/tb.php/g4_qa/57116
  icon_link.gif (0)
아래는 최근게시물 소스입니다.
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
               where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";
if ($gr_id)
    $sql_common .= " and b.gr_id = '$gr_id' ";
if ($view == "w")
    $sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
    $sql_common .= " and a.wr_id <> a.wr_parent ";
if ($mb_id)
    $sql_common .= " and a.mb_id = '$mb_id' ";
$sql_order = " order by a.bn_id desc ";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$group_select = "<select name=gr_id id=gr_id onchange='select_change();'><option value=''>전체그룹";
//$sql = " select gr_id, gr_subject from $g4[group_table] order by gr_id ";
// 제외그룹설정 root님
// html , banner , guest 라는 그룹은 제외시킴
$sql = " select * from $g4[group_table] where gr_id not in ('guest') order by gr_1";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
    $group_select .= "<option value='$row[gr_id]'>$row[gr_subject]";
}
$group_select .= "</select>";

$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
          $sql_common
          $sql_order
          limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
    $tmp_write_table = $g4[write_prefix] . $row[bo_table];
    if ($row[wr_id] == $row[wr_parent]) // 원글
    {
        $comment = "";
        $comment_link = "";
        $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' ");
        $list[$i] = $row2;
        $name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
        // 당일인 경우 시간으로 표시함
        $datetime = substr($row2[wr_datetime],0,10);
        $datetime2 = $row2[wr_datetime];
        if ($datetime == $g4[time_ymd])
            $datetime2 = substr($datetime2,11,5);
        else
            $datetime2 = substr($datetime2,5,5);
    }
    else // 코멘트
    {
        $comment = "[코] ";
        $comment_link = "#c_{$row[wr_id]}";
        $row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
        $row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from $tmp_write_table where wr_id = '$row[wr_id]' ");
        $list[$i] = $row2;
        $list[$i][mb_id] = $row3[mb_id];
        $list[$i][wr_name] = $row3[wr_name];
        $list[$i][wr_email] = $row3[wr_email];
        $list[$i][wr_homepage] = $row3[wr_homepage];
        $name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
        // 당일인 경우 시간으로 표시함
        $datetime = substr($row3[wr_datetime],0,10);
        $datetime2 = $row3[wr_datetime];
        if ($datetime == $g4[time_ymd])
            $datetime2 = substr($datetime2,11,5);
        else
            $datetime2 = substr($datetime2,5,5);
    }
    $list[$i][gr_id] = $row[gr_id];
    $list[$i][bo_table] = $row[bo_table];
    $list[$i][name] = $name;
    $list[$i][comment] = $comment;
    $list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
    $list[$i][datetime] = $datetime;
    $list[$i][datetime2] = $datetime2;
    $list[$i][gr_subject] = $row[gr_subject];
    $list[$i][bo_subject] = $row[bo_subject];
    $list[$i][wr_subject] = $row2[wr_subject];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&mb_id=$mb_id&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
include_once("$new_skin_path/new.skin.php");
include_once("./_tail.php");
?>
--------------------------------------
제그룹에 z6이라는 그룹이 있거든요..메인 최신글에 안보이게 하고 싶어요....

duffla1.gif 열정 (123.♡.86.93)   img_choice.gif btn_comment_reply.gif   07-03-30 16:03
co_point.gif
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
              where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' ";
여기에서
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
              where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and c.gr_id <> 'z6' ";

이렇게 하면 될듯..
<? include_once("./_common.php"); $g4[title] = "최근 게시물"; include_once("./_head.php"); $sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' "; 여기에서 <? include_once("./_common.php"); $g4[title] = "최근 게시물"; include_once("./_head.php"); $sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and c.gr_id <> 'z6' "; 이렇게 하면 될듯..
잘몰라 (220.♡.171.178) btn_comment_reply.gif btn_comment_update.gif btn_comment_delete.gif   07-03-30 17:55
co_point.gif
아감사합니다..고수님...
근데 최근게시물 보드에서는 안보이는데 최근게시물 최신글에서는 보이는데
메인화면의 최근게시물최신글에서 안보이게 할려면 어떻게 해요..

최근게시물로연결된최신글 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

// 위로 스크롤되는 최신글

// 사용법 :
// 스킨, 게시판아이디, 출력라인, 글자수, "몇개라인,라인높이"
// latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")

// $rows(출력라인)는 $line_mod의 2의 배수 이상으로 설정하셔야 합니다.

// 유니크 값 (최신글은 한페이지에 여러개 둘 수 있으므로... 자바스크립트에서 함수, 변수 충돌을 방지)
$uni = md5(uniqid(rand(), true));

list($line_mod, $height) = explode(",", $options);

$box_height = (int)$line_mod * (int)$height;
?>

<table width=100% cellpadding=0 cellspacing=0 border=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr><td>
<table width=480 cellpadding=0 cellspacing=0 bgcolor=#E2E8FD>
<tr><td width=435 height=30>   <a href="./bbs/new.php"><b>최근게시물</b></a>   <font color="gray">
<?// $my[time_Hms] = date("H시 i분 s초",time());  echo("$my[time_Hms]"); ?>

<?
$a = date ("Y년 m월 j일");
$today = date("w");

if($today == 0) $day = "(일)";
else if($today == 1) $day = "(월)";
else if($today == 2) $day = "(화)";
else if($today == 3) $day = "(수)";
else if($today == 4) $day = "(목)";
else if($today == 5) $day = "(금)";
else if($today == 6) $day = "(토)";

echo "$a $day";
?> 
<? $my[time_Hms] = date("H시 i분 s초",time());  echo("$my[time_Hms]"); ?></font></td>





<td></td></tr>
<tr><td colspan=2 align=center><table id=new_all width=95% cellpadding=0 cellspacing=0 bgcolor=#FFFFFF><tr><td style='padding:4px;'>
                <nobr style='display:block; overflow:hidden; width:435;'>


<? if (count($list) == 0) { ?>
    <tr><td colspan=4 align=center height=50>게시물이 없습니다.</td></tr>
<? } else { ?>

    <script language="javascript">
    var roll_height_<?=$uni?> = <?=$box_height?>;
    var total_area_<?=$uni?> = 0;
    var wait_flag_<?=$uni?> = true;

    var bMouseOver_<?=$uni?> = 1;
    var roll_speed_<?=$uni?> = 1;
    var waitingtime_<?=$uni?> = 3000;
    var s_tmp_<?=$uni?> = 0;
    var s_amount_<?=$uni?> = <?=(int)$height?>;
    var roll_text_<?=$uni?> = new Array();
    var startPanel_<?=$uni?> = 0;
    var n_panel_<?=$uni?> = 0;
    var i_<?=$uni?> = 0;

    function start_roll_<?=$uni?>()
    {
        i_<?=$uni?> = 0;
        for (i_<?=$uni?> in roll_text_<?=$uni?>)
            n_panel_<?=$uni?>++;

        n_panel_<?=$uni?> = n_panel_<?=$uni?> -1 ;
        startPanel_<?=$uni?> = Math.round(Math.random()*n_panel_<?=$uni?>);
        if(startPanel_<?=$uni?> == 0) {
            i_<?=$uni?> = 0;
            for (i_<?=$uni?> in roll_text_<?=$uni?>)
                insert_area_<?=$uni?>(total_area_<?=$uni?>, total_area_<?=$uni?>++);
        } else if(startPanel_<?=$uni?> == n_panel_<?=$uni?>) {
            insert_area_<?=$uni?>(startPanel_<?=$uni?>, total_area_<?=$uni?>);
            total_area_<?=$uni?>++;
            for (i_<?=$uni?>=0; i_<?=$uni?><startPanel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
        } else if((startPanel_<?=$uni?> > 0) || (startPanel_<?=$uni?> < n_panel_<?=$uni?>)) {
            insert_area_<?=$uni?>(startPanel_<?=$uni?>, total_area_<?=$uni?>);
            total_area_<?=$uni?>++;
            for (i_<?=$uni?>=startPanel_<?=$uni?>+1; i_<?=$uni?><=n_panel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
            for (i_<?=$uni?>=0; i_<?=$uni?><startPanel_<?=$uni?>; i_<?=$uni?>++) {
                insert_area_<?=$uni?>(i_<?=$uni?>, total_area_<?=$uni?>);
                total_area_<?=$uni?>++;
            }
        }
   
        if ( navigator.appName == "Microsoft Internet Explorer" ) {
            if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 )
            return ;
        }
        window.setTimeout("rolling_<?=$uni?>()",waitingtime_<?=$uni?>);
    }

    function rolling_<?=$uni?>()
    {
        if (bMouseOver_<?=$uni?> && wait_flag_<?=$uni?>) {
            for (i_<?=$uni?>=0;i_<?=$uni?><total_area_<?=$uni?>;i_<?=$uni?>++) {
                tmp_<?=$uni?> = document.getElementById('scroll_area_<?=$uni?>'+i_<?=$uni?>).style;
                tmp_<?=$uni?>.top = parseInt(tmp_<?=$uni?>.top)-roll_speed_<?=$uni?>;
             
                if (parseInt(tmp_<?=$uni?>.top) <= -roll_height_<?=$uni?>) {
                    tmp_<?=$uni?>.top = roll_height_<?=$uni?>*(total_area_<?=$uni?>-1);
                }
             
                if (s_tmp_<?=$uni?>++ > (s_amount_<?=$uni?>-1)*roll_text_<?=$uni?>.length) {
                    wait_flag_<?=$uni?>=false;
                    window.setTimeout("wait_flag_<?=$uni?>=true;s_tmp_<?=$uni?>=0;",waitingtime_<?=$uni?>);
                }
            }
        }
        window.setTimeout("rolling_<?=$uni?>()", 1);
    }

    function insert_area_<?=$uni?>(idx_<?=$uni?>, n_<?=$uni?>)
    {
        document.write('<div style="left: 0px; width: 100%; position: absolute; top: '+(roll_height_<?=$uni?>*n_<?=$uni?>)+'px" id="scroll_area_<?=$uni?>'+n_<?=$uni?>+'">\n'+roll_text_<?=$uni?>[idx_<?=$uni?>]+'\n</div>\n');
    }

    <?
    unset($roll_text);
    for ($i=0; $i<count($list); $i++) {
        $href = "<a href='./?doc=$cart_dir/item.php&it_id=$row[it_id]' class=item>";

        $k = (int)($i / $line_mod);
$list[$i][gr_subject] =addslashes($list[$i][gr_subject]);
$list[$i][bo_subject] =addslashes($list[$i][bo_subject]);
$list[$i][wr_subject] =addslashes($list[$i][wr_subject]);

        $roll_text[$k] .= "<div style=\"height:{$height}px; padding-top:0px;\">";
        //$roll_text[$k] .= "<div style=\"height:{$height}px; padding-top:5px;\">";
        $roll_text[$k] .= "<img src=\"{$latest_skin_path}/img/latest_icon.gif\" align=absmiddle border=0>  ";
        $roll_text[$k] .= "<a href=\"{$list[$i][href]}\">";
        $roll_text[$k] .= "[";
        $roll_text[$k] .= $list[$i][gr_subject];
        $roll_text[$k] .= "/";
        $roll_text[$k] .= $list[$i][bo_subject];
        $roll_text[$k] .= "] ";
        $roll_text[$k] .= $list[$i][wr_subject];
        //$roll_text[$k] .= "[";
        //$roll_text[$k] .= $list[$i][gr_subject];
        //$roll_text[$k] .= "] ";
        //$roll_text[$k] .= $list[$i][wr_subject];
        if ($list[$i][comment_cnt])
            $roll_text[$k] .= " {$list[$i][comment_cnt]}";
        $roll_text[$k] .= "</a>";
        $roll_text[$k] .= "</div>";
    }

    for ($i=0; $i<=$k; $i++) {
        echo "roll_text_{$uni}[$i] = '{$roll_text[$i]}';\n";
    }
    ?>
    </script>

    <div style="left: 0px; width: 100%; position: relative; top: 5px; height: <?=$box_height?>px; overflow:hidden;" onMouseover="bMouseOver_<?=$uni?>=0" onMouseout="bMouseOver_<?=$uni?>=1" id="latest_scroll_<?=$uni?>">
    <script language='javascript'>
    var no_script_flag_<?=$uni?> = false ;
    if ( navigator.appName == "Microsoft Internet Explorer" ) {
        if ( navigator.appVersion.indexOf ( "MSIE 4" ) > -1 ) {
            document.write ( roll_text_<?=$uni?>[0] ) ;
            no_script_flag_<?=$uni?> = true ;
        }
    }
    if ( no_script_flag_<?=$uni?> == false )
        start_roll_<?=$uni?>();
    </script>
    </div> 

<? } ?>

                </nobr></td></tr></table></td></tr>
<tr><td colspan=2 height=10></td></tr>
</table></td>
</tr></table>

댓글 전체

스킨에서의 수정이 아니라 쿼리가 정의되어 있는 라이브러리파일을 수정...

수정대상파일:
스킨을 호출하는 함수가 <?= latest(....)?> 이런식이라면...
그누보드/lib/latest.lib.php 

스킨을 호출하는 함수가 <?= latest_scroll(....)?> 이런식과 같이 다른 형태라면...
latest_scroll정의가 포함되어 있는
그누보드/lib/예제.lib.php 혹은 그누보드/lib/extend/예제.lib.php

의 sql쿼리부분을 다음과 같이 수정하셔야 합니다...


원본
-----------------------------------------------------------------
    $sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
        from $g4[board_new_table] a, $g4[board_table] b,  $g4[group_table] c
        where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and  a.wr_id = a.wr_parent
        order by a.bn_id desc limit 0,$rows";
-----------------------------------------------------------------


수정
-----------------------------------------------------------------
          $sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
          from $g4[board_new_table] a, $g4[board_table] b,  $g4[group_table] c
          where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and  a.wr_id = a.wr_parent and c.gr_id <> 'z6'
        order by a.bn_id desc limit 0,$rows";
-----------------------------------------------------------------
두서없는 글 관심있게 읽어 주셔서 너무너무 감사드립니다.
호출하는 함수는 <?= latest_scroll(....)?> 이렇게 되어있구요...
/lib/예제.lib.php 혹은 /lib/extend/예제.lib.php  가 아무리 찾아도 없어요...
이파일은 어디에 있을까요?
시그너스님 조금만 더 가르쳐 주세요...
index.php상단에..
<?= latest_scroll(....)?>를 호출하기 위해 상단인클루드lib파일이 어떤식으로 정의됐나 살펴보세요...
-----------------------------------------------
include_once("$g4[path]/lib/latest.lib.php");
-----------------------------------------------
이게 단독으로 한줄로만 정의 되어 있다라면..
latest.lib.php

-----------------------------------------------
include_once("$g4[path]/lib/latest.lib.php");
include_once("$g4[path]/extend/latest_scroll.lib.php");
-----------------------------------------------
이런식이라면 latest.lib.php, latest_scroll.lib.php 둘중의 하나에...



-----------------------------------------------------------
function latest_scroll($skin_dir="",$rows, $subject_len,$options="")
___________________________________________________________
이런펑션으로 함수화 되어 있는 구문이 포함된 파일을 찾아 위 sql쿼리문이 있는곳을 수정하시면 됩니다...

쪽지질문 좋아하지 않습니다...더이상의 추가질문도 사양하며 추가답변도 죄송하지만 드리지 않겠습니다..
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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