<코멘트, 최근글에 불러오기> 다시한 번 질문이요!! > 그누4 질문답변

그누4 질문답변

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

<코멘트, 최근글에 불러오기> 다시한 번 질문이요!! 정보

<코멘트, 최근글에 불러오기> 다시한 번 질문이요!!

본문

공수래공수거님 보내주신 답변 잘 보았습니다.
그런데 제가 워낙 초보라 잘 못알아 듣겠네요.
소스를 보내드리니 다시 한 번 답변부탁드립니다.
참고하실 사이트 www.jayu.or.kr

<?php
function get_new2($rowCnt, $maxStr)
{
 global $g4, $gr_id, $config;
 $maxRow = 100;
 
 $exc = "('f_bbs','f_pic','f_vod')";
 $s = "
  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.bo_table not in {$exc}
   and b.gr_id = c.gr_id
   and b.bo_use_search = '1'
  order by a.bn_id desc
  limit $maxRow
  ";
 $i = 0;
 $res = mysql_query($s);
 while ($row = mysql_fetch_array($res))
 {
  if ($i >= $rowCnt) break;
  
  if ($row[wr_id] == $row[wr_parent])
  {
   $s = "
    select wr_id, wr_subject, wr_comment, wr_datetime,  wr_name
    from $g4[write_prefix]$row[bo_table]
    where wr_id = '$row[wr_id]'
    ";
   $list[$i] = mysql_fetch_array(mysql_query($s));
   $list[$i][commentCnt] = $list[$i][wr_comment];
   $list[$i][bo_subject] = $row[bo_subject];
   $list[$i][subject] = cut_str(get_text($list[$i][wr_subject]), $maxStr);
   $list[$i][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id={$list[$i][wr_id]}";
   $list[$i][title] = addslashes(get_text($list[$i][wr_subject])." / ".$list[$i][wr_datetime]);
            $list[$i][title] = addslashes(get_text($list[$i][wr_subject])." / ".$list[$i][wr_datetime]);
            $list[$i]['icon_new'] = "";
            if ($list[$i][wr_datetime] >= date("Y-m-d H:i ", $g4['server_time'] - (1 * 24 * 3600))){ // 3은 날짜
            $list[$i][icon_new] = "<img src='$g4[path]/skin/latest/basic/img/icon_new.gif' align='absmiddle'>";}
   $i++;
  }
 }
 
 return $list;
}
function my_new2($rowCnt = 10, $maxStr = 20, $maxWidth = "100%") { global $g4; $list = get_new2($rowCnt, $maxStr); ?>
<table width="95%" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    </table></td>
  </tr>
  <?php $n = count($list); for ($i = 0; $i < $n; $i++) { ?>
  <tr>
    <td colspan="4"><table width="95%">
      <tr>
        <td height="19"><nobr style='display:block; overflow:hidden; width:210;'> <span style="font-weight:normal;">
                <a href="<?php echo $list[$i][href]; ?>" title="<?php echo $list[$i][title]; ?>"> [<?php echo $list[$i][wr_name]; ?>]       
    <?=$list[$i][icon_new]?> <?php echo $list[$i][subject]; ?>
                <?php if ($list[$i][commentCnt]) { ?>
                <font color="tomato">(<?php echo $list[$i][commentCnt]; ?>)</font>
                <?php } ?>
    <br>
                <?=$list[$i][datetime]?>
                </span> </a> </nobr> </td>
      </tr>
    </table></td>
  </tr>
  <?php } ?>
</table>
<?php } ?>

댓글 전체

소스 자체에 코멘트가 안나오게 되어있군요. while 부분을 아래와 같이 변경해주시면 됩니다.

 while ($row = mysql_fetch_array($res))
 {
  if ($i >= $rowCnt) break;
 

  $s = "
    select wr_id,wr_is_comment, wr_subject,wr_content, wr_comment, wr_datetime,  wr_name
    from $g4[write_prefix]$row[bo_table]
    where wr_id = '$row[wr_id]'
    ";
  $list[$i] = mysql_fetch_array(mysql_query($s));
  $list[$i][commentCnt] = $list[$i][wr_comment];
  $list[$i][bo_subject] = $row[bo_subject];
  if($list[$i][wr_is_comment] == "1"){
  $list[$i][subject] = "(코멘트)".cut_str(get_text($list[$i][wr_content]), $maxStr);
  }else{
  $list[$i][subject] = cut_str(get_text($list[$i][wr_subject]), $maxStr);
  }
  $list[$i][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id={$list[$i][wr_id]}";
  $list[$i][title] = addslashes(get_text($list[$i][wr_subject])." / ".$list[$i][wr_datetime]);
            $list[$i][title] = addslashes(get_text($list[$i][wr_subject])." / ".$list[$i][wr_datetime]);
            $list[$i]['icon_new'] = "";
            if ($list[$i][wr_datetime] >= date("Y-m-d H:i ", $g4['server_time'] - (1 * 24 * 3600))){ // 3은 날짜
            $list[$i][icon_new] = "<img src='$g4[path]/skin/latest/basic/img/icon_new.gif' align='absmiddle'>";}
  $i++;

 }
 
 return $list;
}
전체 23 |RSS

회원로그인

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