분류 전체 갯수가 세부분류로 들어가면 갯수가 줄어듭니다..

category.php 는 다음의 내용을 사용하고 있습니다..

<style type='text/css'>
/*-- 카테고리명 --*/
.cate {font-family:Tahoma,굴림,arial; color:#666666; font-size:12px;}
a.cate:link, a.b_ca:visited, a.b_ca:active {font-family:Tahoma,굴림,arial; color:#666666; font-size:12px;}
a.cate:hover {font-family:Tahoma,굴림, arial; color:#FF6600; font-size:12px; text-decoration:underline;}
</style>

<? $cnt_bo_1 = 4; // 한줄당 분류 갯수 ?>

<? if (!$wr_id) { ?>
<!-- 분류 셀렉트 박스 시작 -->
<?
$cnt = 1;
$sql = " SELECT bo_category_list FROM $g4[board_table] WHERE bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
$str = "";
$str .= "<tr>";
for ($i=0; $i<count($arr); $i++)
if (trim($arr[$i])) {
$sql1 = " SELECT count(*) as cCount FROM $write_table WHERE ca_name = '$arr[$i]' and wr_is_comment = 0 ";
$row1 = sql_fetch($sql1);
$str .= "<td><img src='{$board_skin_path}/img/ico_folder.gif' width='13' height='11'> <a class='cate' href='./board.php?bo_table=$bo_table&sca=$arr[$i]&sop=&sst=wr_1&sod=desc&sfl=&stx=&page=1'>$arr[$i] ($row1[cCount])</a></td>";
if ($cnt == $cnt_bo_1) { $cnt = 0; $str .= "</tr><tr>"; }
$cnt++;
}

$sql2 = " SELECT count(*) as cCount FROM $write_table WHERE wr_is_comment = 0 ";
$row2 = sql_fetch($sql2);
$Total_Cat = $row2[cCount]
?>

<table width=100% cellspacing=1 cellpadding=4 border=0 style=table-layout:fixed>
<col width=75></col>
<col width=20></col>
<col width=></col>

<tr bgcolor=white>
<td width='' align='center'>
<img src='<?=$board_skin_path?>/img/ico_folder.gif' width='13' height='11'> <a class='cate' href='./board.php?bo_table=<?=$bo_table?>&sca=<?=$arr[$i]?>&sop=&sst=wr_1&sod=desc&sfl=&stx=&page=1'><b>전체 (<?=number_format($total_count)?>)</b></a>
</td>
<td nowrap> </td>
<td width='' style='word-break:break-all;'>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
<span class="cate"><?=$str?></span>
</table>
</td>
</tr>
</table>
<!-- 분류 셀렉트 박스 끝 -->
<? } ?>


여기서 밑에 질답에 있던 것처럼
wr_comment >= 0 을 wr_is_comment=0 으로 바꿨더니
코멘트의 갯수까지 세부분류의 갯수로 잡던 문제는 해결하였습니다..

그런데 문제는

>>> 전체(5) 분류1(2) 분류2(1) 분류3(2)

라고 있다고 가정했을 때.. 분류1로 들어가면

>>> 전체(2) 분류1(2) 분류2(1) 분류3(2)

이렇게 전체 괄호 안의 갯수가 바뀌어버리는 것입니다..
다른 분류를 들어가도 그 분류의 리스트 갯수로 바뀌어버립니다..
아마 선택한 분류의 갯수로 숫자가 바뀌는 것 같습니다..

어떤 분류로 들어가더라도 전체의 갯수는 그 게시판 전체의 리스트 갯수로 나오게 하는 방법이 없을까요?

요새 염치불구하고 질문을 무척이나 많이 던집니다.. ^^
부탁드립니다 꾸벅~
|

댓글 4개

$total_count = $row[cCount]
머이런 비슷 한 코드가 있으실텐데요
그윗부분 쿼리을 수정하시던지 아니면 $total_count2 이런식으로해서 하나 더 만드셔서
아래 부분을
전체 (<?=number_format($total_count2)?>
이런식으로 수정하시면될것같내요
$sql2 = " SELECT count(*) as cCount FROM $write_table WHERE wr_is_comment = 0 ";
$row2 = sql_fetch($sql2);
$Total_Cat = $row2[cCount]

라고 적혀있네요... 전체 <?=number_format($Total_Cat)?>가 되겠죠
탑스쿨님 답변 감사드립니다 ^^

$total_count = $row[cCount]
이 부분은 없구
$total_cat = $row2[cCount]
이 부분만 있네요..

쿼리를 만들어서 실험해보겠습니다..
청춘불안정님 감사합니다 ^^

구문을 전체적으로 이해하기엔 아직 지식이 얕아서 꼭 물어봐야 해결이 돼네요..
조금 더 공부를 해야하나봐요..

두분 덕택에 또 한문제 해결했습니다..
너무 감사드립니다 ^^
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
17년 전 조회 710
17년 전 조회 724
17년 전 조회 953
17년 전 조회 713
17년 전 조회 632
17년 전 조회 815
17년 전 조회 629
17년 전 조회 633
17년 전 조회 795
17년 전 조회 812
17년 전 조회 741
17년 전 조회 897
17년 전 조회 771
17년 전 조회 766
17년 전 조회 748
17년 전 조회 739
17년 전 조회 940
17년 전 조회 1,134
17년 전 조회 823
17년 전 조회 802