리플수 조회수로 뽑는 bbs방의 new.php ..약간수정 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

리플수 조회수로 뽑는 bbs방의 new.php ..약간수정 정보

리플수 조회수로 뽑는 bbs방의 new.php ..약간수정

본문

<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");
#######################################
#bbs 방의 new.php를 약간 수정했습니다.
#일정수의 게시물이 없을때나 안 뽑히는 문제..암튼 약간..수정됨.
#######################################
#일년안에 쓴글에서 추출합니다.
#만약 여기를 7로 바꾸면 일주일안에 등록된 식당이니 신규
#식당이나..뭐..그리 바꾸면 되지않을까..
#무조건 뽑아내는..최신글 스타일 말고...물론 쿼리하면서
#조건을 줘도 되겠지만..
$before_day =365;  #뒤로 며칠전부터 쓴글...수정要:1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
#######################################
#수정要3:추출할 그룹명......!!!
$gr_id = "gb4_baedal";
#######################################
#bo_table bo_notics 를 보드정보테이블 해당그룹만 추출
$sql = " select bo_table, bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_comment > -1 or wr_hit) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";
        $list1[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][comment] = $row2[wr_comment];
        $list1[$key][comment_cnt] = "($row2[wr_comment])";
        ######################################
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
        $list2[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";
        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>





<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP
<?$SK=$top1-1;?>
<?=$SK?>(cmt)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";
                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                echo "</a>";

                if ($list1[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";
                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                echo "</a>";

                if ($list2[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM
                <?$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                echo "</a>";

                if ($list3[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list4[$key][icon_reply] . " ";
                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                echo "</a>";

                if ($list4[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<?
include_once("./_tail.php");
?>
추천
2

댓글 16개

오우~ 뭔가 했네요
안나오는 부분을 멋지게 수정하셨군요
--------------------------------

 1 [게시판]질문이여... (9) 
 2 [공지사항]요거.. (9) 
 3 [질문/답변]확인해 보세요.. (8) 
 4 [염장]대하 맛나나요?? (8) 
 5 [등급업]등급부탁드립니다. (5) 
-------------------------------------
위에처럼 순위/게시판제목도 나타낼수 있으면 좋겠네요.
감사합니다.
ㅡㅡㅋ 게시판제목까지..추출??? 요렇게 하면 될것같은데...해보세요..저는 잘 됩니다.
현재 그누 메인처럼..말씀하신게 맞나요?
.
.
<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");
#######################################
#bbs 방의 new.php를 약간 수정했습니다.
#일정수의 게시물이 없을때나 안 뽑히는 문제..튼 약간..수정됨.
#######################################
#일년안에 쓴글에서 추출합니다.
#만약 여기를 7로 바꾸면 일주일안에 등록된 식당이니 신규
#식당이나..뭐..그리 바꾸면 되지않을까..
#무조건 뽑아내는..최신글 스타일 말고...물론 쿼리하면서
#조건을 줘도 되겠지만..
$before_day =365;  #뒤로 며칠전부터 쓴글...수정要:1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
#######################################
#수정要3:추출할 그룹명......!!!
$gr_id = "gb4_baedal";
#######################################
#bo_table bo_notics 를 보드정보테이블 해당그룹만 추출
$sql = " select bo_table, bo_subject ,bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_comment > -1 or wr_hit) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";

        $list1[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list1[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][comment] = $row2[wr_comment];
        $list1[$key][comment_cnt] = "($row2[wr_comment])";
        ######################################
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];


      $list2[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list2[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";
        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>





<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP
<?$SK=$top1-1;?>
<?=$SK?>(cmt)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";
                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else

                    echo "<font style='font-family:돋움; font-size:9pt; color:#006699;'>[{$list1[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                echo "</a>";

                if ($list1[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";
                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#006699;'>[{$list2[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                echo "</a>";

                if ($list2[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM
                <?$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#006699;'>[{$list3[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                echo "</a>";

                if ($list3[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list4[$key][icon_reply] . " ";
                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#006699;'>[{$list4[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                echo "</a>";

                if ($list4[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<?
include_once("./_tail.php");
?>
글세요...몇개 뽑아오는데 순위가 필요있나요..??
하자면 top 에서 순위는 역순이니까 5개를 뽑으면
4 3 2 1 0 이렇게 되는데 먼저 자신의 수를 빼주면 0 이되어서 초기화가 되겠죠?
여기에 자신의 수를 증가 시키면 1 2 3 4 5 이렇게하면
검색 결과가 있을때만 증가가 되는게 아닌지...
아~~ 암튼 저라면 이렇게 했는데..쉽게쉽게하죠..테클걸까 무섭네요--ㅋ
.

<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");
#######################################
#bbs 방의 new.php를 약간 수정했습니다.
#일정수의 게시물이 없을때나 안 뽑히는 문제..튼 약간..수정됨.
#######################################
#일년안에 쓴글에서 추출합니다.
#만약 여기를 7로 바꾸면 일주일안에 등록된 식당이니 신규
#식당이나..뭐..그리 바꾸면 되지않을까..
#무조건 뽑아내는..최신글 스타일 말고...물론 쿼리하면서
#조건을 줘도 되겠지만..
$before_day =365;  #뒤로 며칠전부터 쓴글...수정要:1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
#######################################
#수정要3:추출할 그룹명......!!!
$gr_id = "gb4_baedal";
#######################################
#bo_table bo_notics 를 보드정보테이블 해당그룹만 추출
$sql = " select bo_table, bo_subject ,bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_comment > -1 or wr_hit) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";

        $list1[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list1[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][comment] = $row2[wr_comment];
        $list1[$key][comment_cnt] = "($row2[wr_comment])";
        ######################################
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];


      $list2[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list2[$key][subject] = conv_subject($row2[wr_subject],40,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";
        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>





<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP
                <?$__SK=$_SK=$SK=$top1-1;?>
<?$SK=$top1-1;?>
<?=$SK?>(cmt)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";

                $SK=(++$_SK)-$__SK;
                echo "<font color='gray'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else

                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list1[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                echo "</a>";

                if ($list1[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP
                <?$__OK=$_OK=$OK=$top1-1;?>
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";

                $OK=(++$_OK)-$__OK;
                echo "<font color='blue'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list2[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                echo "</a>";

                if ($list2[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM
                <?$__OK=$_OK=$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                $OK=(++$_OK)-$__OK;
                echo "<font color='green'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list3[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                echo "</a>";

                if ($list3[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?$__SK=$_SK=$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?

                echo $list4[$key][icon_reply] . " ";
                $SK=(++$_SK)-$__SK;
                echo "<font color='red'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list4[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                echo "</a>";

                if ($list4[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";
                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<?
include_once("./_tail.php");


?>
방금 해보니 아주 좋네요. 한가지 더 부탁을 드리자면, 추천, 비추천으로 뽑아볼려면 어디를 고쳐야 하나요?
글쓴이 아이디나 이름을 뽑아올려면        $list1[$key][wr_name] = $row2[wr_name];  이렇게 추가하고 불러오면 되나요?
저도 헷갈리네요...
제 게시판에 글이 별로 없어서...
글쓴이의 id 와 이름입니다..
.
.
<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");
#######################################
#bbs 방의 new.php를 약간 수정했습니다.
#일정수의 게시물이 없을때나 안 뽑히는 문제..튼 약간..수정됨.
#######################################
#일년안에 쓴글에서 추출합니다.
#만약 여기를 7로 바꾸면 일주일안에 등록된 식당이니 신규
#식당이나..뭐..그리 바꾸면 되지않을까..
#무조건 뽑아내는..최신글 스타일 말고...물론 쿼리하면서
#조건을 줘도 되겠지만..
$before_day =365;  #뒤로 며칠전부터 쓴글...수정要:1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
#######################################
#수정要3:추출할 그룹명......!!!
$gr_id = "gb4_baedal";
#######################################
#bo_table bo_notics 를 보드정보테이블 해당그룹만 추출
$sql = " select bo_table, bo_subject ,bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_comment > -1 or wr_hit) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";

        $list1[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list1[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][comment] = $row2[wr_comment];
        $list1[$key][comment_cnt] = "($row2[wr_comment])";

        $list1[$key][mb_id] = "$row2[mb_id]";
        $list1[$key][wr_name] = "$row2[wr_name]";


        ######################################
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];


        $list2[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list2[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";

        $list2[$key][mb_id] = "$row2[mb_id]";
        $list2[$key][wr_name] = "$row2[wr_name]";

        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>





<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP
                <?$__SK=$_SK=$SK=$top1-1;?>
<?$SK=$top1-1;?>
<?=$SK?>(cmt)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";

                $SK=(++$_SK)-$__SK;
                echo "<font color='gray'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else

                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list1[$key][bo_subject]}]</font>";
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                    echo "</a>";

                    if ($list1[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list1[$key][mb_id]}-{$list1[$key][wr_name]}</font>";


                ?>
            </td>
        </tr>

               

        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP
                <?$__OK=$_OK=$OK=$top1-1;?>
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";

                $OK=(++$_OK)-$__OK;
                echo "<font color='blue'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list2[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                    echo "</a>";

                if ($list2[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list2[$key][mb_id]}-{$list2[$key][wr_name]}</font>"; 

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM
                <?$__OK=$_OK=$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                $OK=(++$_OK)-$__OK;
                echo "<font color='green'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list3[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                    echo "</a>";

                    if ($list3[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list3[$key][mb_id]}-{$list3[$key][wr_name]}</font>"; 
               

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?$__SK=$_SK=$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?

                echo $list4[$key][icon_reply] . " ";
                $SK=(++$_SK)-$__SK;
                echo "<font color='red'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list4[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                    echo "</a>";
                    if ($list4[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list4[$key][mb_id]}-{$list4[$key][wr_name]}</font>";

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<?
include_once("./_tail.php");



?>
//추천, 비추천으로 뽑아볼려면 어디를 고쳐야 하나요??
.
.
틀린데가 있을지 모릅니다...
두가지 방법으로
//리플수.히트수에서 게시판제목+글제목+글쓴이ID+Name  방법과
//추천수.비추천수에서 게시판제목+글제목+글쓴이ID+Name  방법 입니다. 잘라서 쓰십시요. YES NO 로...
급하게 하다보니 정렬이 영~~ 아닙니다...
다듬어서 쓰시기 바랍니다.
.
.

<?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
include_once("./_head.php");
#######################################
#bbs 방의 new.php를 약간 수정했습니다.
#일정수의 게시물이 없을때나 안 뽑히는 문제..튼 약간..수정됨.
#######################################
#일년안에 쓴글에서 추출합니다.
#만약 여기를 7로 바꾸면 일주일안에 등록된 식당이니 신규
#식당이나..뭐..그리 바꾸면 되지않을까..
#무조건 뽑아내는..최신글 스타일 말고...물론 쿼리하면서
#조건을 줘도 되겠지만..
$before_day =365;  #뒤로 며칠전부터 쓴글...수정要:1;
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));

#######################################
#수정要2:추출할 그룹명......!!!
$gr_id = "gb4_baedal";

#수정要3:추천수 비추천수로 하냐 히트수 리플수로 하냐 ???
#암튼 둘다 예스...합니다. 잘라서 쓰세요...id 나 name 은 알아서....하시구요.
$hit_ro_ha_ja='YES';
$chu_cheun_soon='YES';


#######################################  히트순이면...!!! 
if ($hit_ro_ha_ja=='YES'):
#######################################
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
#bo_table bo_notics 를 보드정보테이블 해당그룹만 추출
$sql = " select bo_table, bo_subject ,bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_comment > -1 or wr_hit) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";

        $list1[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list1[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][comment] = $row2[wr_comment];
        $list1[$key][comment_cnt] = "($row2[wr_comment])";

        $list1[$key][mb_id] = "$row2[mb_id]";
        $list1[$key][wr_name] = "$row2[wr_name]";


        ######################################
        $key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];


        $list2[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list2[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_hit] = $row2[wr_hit];
        $list2[$key][hit] = "($row2[wr_hit])";

        $list2[$key][mb_id] = "$row2[mb_id]";
        $list2[$key][wr_name] = "$row2[wr_name]";

        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>


<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 TOP
                <?$__SK=$_SK=$SK=$top1-1;?>
<?$SK=$top1-1;?>
<?=$SK?>(cmt)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";

                $SK=(++$_SK)-$__SK;
                echo "<font color='gray'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else

                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list1[$key][bo_subject]}]</font>";
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                    echo "</a>";

                    if ($list1[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][comment_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list1[$key][mb_id]}-{$list1[$key][wr_name]}</font>";


                ?>
            </td>
        </tr>

               

        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 TOP
                <?$__OK=$_OK=$OK=$top1-1;?>
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";

                $OK=(++$_OK)-$__OK;
                echo "<font color='blue'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list2[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                    echo "</a>";

                if ($list2[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][hit]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list2[$key][mb_id]}-{$list2[$key][wr_name]}</font>"; 

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>코멘트 BOTTOM
                <?$__OK=$_OK=$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                $OK=(++$_OK)-$__OK;
                echo "<font color='green'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list3[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                    echo "</a>";

                    if ($list3[$key][comment_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][comment_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list3[$key][mb_id]}-{$list3[$key][wr_name]}</font>"; 
               

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>조회수 BOTTOM <?$__SK=$_SK=$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(hit)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?

                echo $list4[$key][icon_reply] . " ";
                $SK=(++$_SK)-$__SK;
                echo "<font color='red'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list4[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                    echo "</a>";
                    if ($list4[$key][hit])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][hit]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list4[$key][mb_id]}-{$list4[$key][wr_name]}</font>";

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
</tr></table>
<? endif; ?>


<br><br><br><br><br><br><br><br><br>

<p align='center'>
<font color='green'>상단에서 chu_cheun_soon 을 YES 가 아닌 NO 로 하면 <br>
추천순..비추천순인 아래는 나오지 않습니다.</font></p>





<?
#######################################  추천순..비추천순이면...!!! 
if ($chu_cheun_soon=='YES'):
######################################
############  5개만 추출합니다. ##############
$top1 = $top2 = 6;  #수정要2:추출 할 숫자보다 1개더........!!!
$list1 = array(); reset($list1);
$list2 = array();reset($list2);
$list3 = array(); reset($list3);
$list4 = array();reset($list4);
?>
<?
$sql = " select bo_table, bo_subject ,bo_notice from $g4[board_table]
          where gr_id = '$gr_id'
          and bo_use_search = 1 ";
$result = sql_query($sql);

while ($row = sql_fetch_array($result))
{ //고놈에서 일정기간내에 쓴글인데 코멘트와 히트에서
    //코멘트거나 히트에서 일정기간내의 글로 함...2005.10.25
    $sql2 = " select * from $g4[write_prefix]$row[bo_table]
                where ((wr_good > -1 or wr_nogood) and (wr_datetime >= '$before_time')) ";
    $result2 = sql_query($sql2);

  while ($row2 = sql_fetch_array($result2))
    { $key = substr('00000'.$row2[wr_good],-5) . '-' . $row2[wr_id];
      if($row2[wr_subject]){
        //test step..이부분을 놓쳤구랴...그래서 제목이 잘 안나오는..
    //echo"$row2[wr_subject] <br>";

        $list1[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list1[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list1[$key][bo_table] = $row[bo_table];
        $list1[$key][wr_id] = $row2[wr_id];
        $list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list1[$key][wr_good] = $row2[wr_good];
        $list1[$key][wr_good_cnt] = "($row2[wr_good])";

        $list1[$key][mb_id] = "$row2[mb_id]";
        $list1[$key][wr_name] = "$row2[wr_name]";


        ######################################
        $key = substr('00000'.$row2[wr_nogood],-5) . '-' . $row2[wr_id];


        $list2[$key][bo_subject] = conv_subject($row[bo_subject],20,'…' );
        $list2[$key][subject] = conv_subject($row2[wr_subject],20,'…');
        $list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
        $list2[$key][bo_table] = $row[bo_table];
        $list2[$key][wr_id] = $row2[wr_id];
        $list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
        $list2[$key][wr_nogood] = $row2[wr_nogood];
        $list2[$key][wr_nogood_cnt] = "($row2[wr_nogood])";

        $list2[$key][mb_id] = "$row2[mb_id]";
        $list2[$key][wr_name] = "$row2[wr_name]";

        }//if
    } //while
}

$list3 = $list1;
$list4 = $list2;
@krsort($list1);
@krsort($list2);
@ksort($list3);
@ksort($list4);
$latest_skin_path = "$g4[path]/skin/latest/basic";
?>





<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>추천 TOP
                <?$__SK=$_SK=$SK=$top1-1;?>
<?$SK=$top1-1;?>
<?=$SK?>(강추)</strong></font>동일그룹의 여러테이블에서..조건별..무료식당은 free고
나머지는 special</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <?
        $i=0;
        foreach($list1 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list1[$key][icon_reply] . " ";

                $SK=(++$_SK)-$__SK;
                echo "<font color='gray'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list1[$key][href]}'>";
                if ($list1[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list1[$key][subject]}</strong></font>";
                else

                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list1[$key][bo_subject]}]</font>";
                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
                    echo "</a>";

                    if ($list1[$key][wr_good_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list1[$key][wr_good_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list1[$key][mb_id]}-{$list1[$key][wr_name]}</font>";


                ?>
            </td>
        </tr>

               

        <? } ?>

        <? if (count($list1) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>




    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>비추천수 TOP
                <?$__OK=$_OK=$OK=$top1-1;?>
<?$OK=$top1-1;?>
<?=$OK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(비추)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
      foreach($list2 as $key=>$value) {
  if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list2[$key][icon_reply] . " ";

                $OK=(++$_OK)-$__OK;
                echo "<font color='blue'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list2[$key][href]}'>";
                if ($list2[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list2[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list2[$key][subject]}</font>";
                    echo "</a>";

                if ($list2[$key][wr_nogood_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list2[$key][wr_nogood_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list2[$key][mb_id]}-{$list2[$key][wr_name]}</font>"; 

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list2) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>

</tr></table>
<br><br>

<!--2================================================================================-->
<table width="710" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>추천수 BOTTOM
                <?$__OK=$_OK=$OK=$top1-1;?>
<?=$OK?>
</strong></font>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list3 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?
                echo $list3[$key][icon_reply] . " ";
                $OK=(++$_OK)-$__OK;
                echo "<font color='green'><b>$OK.&nbsp;</b></font>";

                echo "<a href='{$list3[$key][href]}'>";
                if ($list3[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list3[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list3[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list3[$key][subject]}</font>";
                    echo "</a>";

                    if ($list3[$key][wr_good_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list3[$key][wr_good_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list3[$key][mb_id]}-{$list3[$key][wr_name]}</font>"; 
               

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list3) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
    <td width="20">&nbsp;</td>
    <td width="345" valign=top>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="29" height="38"><img src="<?=$latest_skin_path?>/img/board_title_left.gif" width="29" height="38"></td>
            <td background="<?=$latest_skin_path?>/img/board_title_bg.gif">&nbsp; <font
                style='font-family:돋움; font-size:9pt; color:#696969;'><strong>비추천수 BOTTOM <?$__SK=$_SK=$SK=$top1-1;?>
<?=$SK?></strong></font> <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>(비추)</span>&nbsp;</td>
            <td width="60" align="right" background="<?=$latest_skin_path?>/img/board_title_bg.gif"></td>
            <td width="19"><img src="<?=$latest_skin_path?>/img/board_title_right.gif" width="19" height="38"></td>
        </tr>
        </table>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $i=0;
        foreach($list4 as $key=>$value) {
            if ($i++>=($top1-1)) break;
        ?>
        <tr>
            <td width="40" height="35" align="center" valign="middle" background="<?=$latest_skin_path?>/img/board_bg_line.gif"><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
            <td background="<?=$latest_skin_path?>/img/board_bg_line.gif" style='word-break:break-all;'>
                <?

                echo $list4[$key][icon_reply] . " ";
                $SK=(++$_SK)-$__SK;
                echo "<font color='red'><b>$SK.&nbsp;</b></font>";

                echo "<a href='{$list4[$key][href]}'>";
                if ($list4[$key][is_notice])
                    echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list4[$key][subject]}</strong></font>";
                else
                    echo "<font style='font-family:돋움; font-size:9pt; color:#8d1009;'>[{$list4[$key][bo_subject]}]</font>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list4[$key][subject]}</font>";
                    echo "</a>";
                    if ($list4[$key][wr_nogood_cnt])
                    echo " <span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list4[$key][wr_nogood_cnt]}</span>";

                    echo "<font style='font-family:돋움; font-size:9pt; color:#003366;'>
{$list4[$key][mb_id]}-{$list4[$key][wr_name]}</font>";

                ?>
            </td>
        </tr>
        <? } ?>

        <? if (count($list4) == 0) { ?>
        <tr><td colspan=2 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
        <? } ?>
        </table>
    </td>
</tr></table>
<? endif; ?>


<br><br>
<?
include_once("./_tail.php");



?>
감사합니다.

이런 좋은 실력이 없어서 전체글에서 뽑아서 dB에 넣고 다시 뽑아오는 방법으로 했었거든요.

정말 깔끔하고 한번에 여러가지를 볼 수 있어서 좋네요. ^^
전체 1 |RSS
그누4 팁자료실 내용 검색

회원로그인

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