답변 3개
그냥 단순히 sql 명령어로 하셔도 될것 같네요.
</p>
<p> if ($list[$i]['comment_cnt']) {
// echo "<span class=\"lt_cmt\">".$list[$i]['wr_comment']."</span>";
$secret_cnt = "select count(*) as cnt from `g5_write_".$list[$i]['bo_table']."` where `wr_parent` = '".$list[$i]['wr_id']."' and `wr_option` like '%secret%' ";
$secret_cnt = sql_fetch($secret_cnt);
$nosecret_cnt = $list[$i]['wr_comment'] - $secret_cnt['cnt'];//원래 코멘트에서 비밀댓글 수를 뺌
echo "<span class=\"lt_cmt\">".$secret_cnt['cnt']."</span>"; //비밀댓글 수
echo "<span class=\"lt_cmt\">".$nosecret_cnt."</span>"; //비밀댓글이 아닌수
}</p>
<p>
답변에 대한 댓글 2개
and `wr_is_comment` = '1'
이걸 추가해주세요~
$secret_cnt = "select count(*) as cnt from `g5_write_".$list[$i]['bo_table']."` where `wr_parent` = '".$list[$i]['wr_id']."' and `wr_is_comment` = '1' and `wr_option` like '%secret%' ";
위대로 하면 본문글이 비밀글일 때도 같이 카운트 1개가 늘어납니다~
댓글을 작성하려면 로그인이 필요합니다.
SQL을 통해서 구하시는게 아니라면
$listcnt = count($list);
$seccnt = 0;
$nseccnt = 0;
for ($i=0; $i < $listcnt; $i++) {
if ($list[$i]['wr_option'] == 'secret')
$seccnt += $list[$i]['comment_cnt'];
else
$nseccnt +=$list[$i]['comment_cnt'];
}
echo "비밀댓글수 : ".$seccnt."
";
echo "일반댓글수 : ".$nseccnt."
";
로 하셔야 할것 같습니다.
답변에 대한 댓글 2개
<?
$row = sql_fetch("select count(*) as cnt from g5_write_free where wr_option = secret ");
echo $row[cnt];
?>
이런방법으로도 못구하고 혹시 latest.lib.php를 수정해야 하는 것일까요?
댓글을 작성하려면 로그인이 필요합니다.
list comment_cnt가 코맨트 cnt 갯수라면 php단에서 where절로 구분해서 comment_cnt , comment_hide_cnt등으로 구분해서 2개를 뽑아내서 뿌려주면 되겠네요
} ?>
여기서 secret 비밀댓글 여부와 관계없이 comment_cnt값은 같은값일거같네요
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인