j

최근 목록에 코멘트도 불러올때

chlrms.jpg
메인 화면에 최근 목록을 코멘트도 불러오려고 합니다.

그런데 코멘트는 따로 제목이 없으니까 코멘트 자신의 맨 윗줄이 뜨게 됩니다.

이렇게 말고 코멘트가 달린 원글의 제목이 뜨게는 할 수 없을까요?

아래는 최근 목록의 소스 입니다.

어느 부분을 고쳐야 할지 알려 주세요.^^

<?php

function get_new($rowCnt, $maxStr)
{
global $g4, $gr_id, $config;

$maxRow = 100;

$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.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;


$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;
}

function my_new($rowCnt = 10, $maxStr = 20, $maxWidth = "100%") { global $g4; $list = get_new($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 } ?>

첨부파일

chlrms.jpg (26.1 KB)
0회 2010-03-15 11:46
|
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
15년 전 조회 1,328
15년 전 조회 1,951
15년 전 조회 737
15년 전 조회 809
15년 전 조회 966
15년 전 조회 903
15년 전 조회 1,550
15년 전 조회 1,567
15년 전 조회 1,600
15년 전 조회 876
15년 전 조회 956
15년 전 조회 781
15년 전 조회 991
15년 전 조회 2,036
15년 전 조회 1,150
15년 전 조회 1,000
15년 전 조회 1,557
15년 전 조회 1,062
15년 전 조회 1,540
15년 전 조회 1,674