카테고리 관련 좀 봐주세요. 정보
카테고리 관련 좀 봐주세요.
본문
보통 게시판 리스트 위에 카테고리가 있으면 나오고 없으면 안나오잖아요.
카테고리가 없어도 전체 게시물 갯수는 나오던데
전 그 테이블 자체도 안나오도록 하고 싶거든요.
물론 카테고리가 있을때는 이 테이블이 나와야겠구요.
어떻게 하는게 좋을까요?
<? if ($is_category) { ?> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td height="40" valign="top"> <form name='fcategory' method='get'> <? $cnt_bo_1 = $bo_1[0] ? $bo_1[0] : 10; // 한줄당 분류 갯수(현재:10) $cnt = 1; $cnt0 = 0; $arr = explode("|", $board[bo_category_list]); // 구분자가 , 로 되어 있음 for ($i=0; $i<count($arr); $i++) if (trim($arr[$i])) { $sql1 = " SELECT count(*) as cCount FROM $write_table where wr_is_comment = 0 and ca_name = '$arr[$i]' "; $row1 = sql_fetch($sql1); if ($sca == $arr[$i]) { $cnt0++; $b_s="";$cc=$f_open; $b_e=""; } else {$b_s=""; $cc=$f_close; $b_e="";} $str .= "<a href='./board.php?bo_table=$bo_table&sca=" . rawurlencode($arr[$i]) . "' class='mw_basic_list_category'>$cc$b_s$arr[$i]$b_e</a>($row1[cCount]) "; if ($cnt == $cnt_bo_1) { $cnt = 0; $str .= "<br>"; } $cnt++; } if ($cnt0 == 0 ) { $bb_s=""; $bb_e=""; } ?> <a href='./board.php?bo_table=<?=$bo_table?>&page=<?=$page?>'><strong>전체</strong></a> (<?=$total_count?>) <br /> <?=$str?> </form> </td> </tr> <tr> <td height="1" bgcolor="dfdfdf"></td> </tr> </table> <? } ?> |
댓글 전체

if (isset($sca)) {
$sca = mysql_real_escape_string($sca);
$qstr .= '&sca=' . urlencode($sca);
}
=>
if( empty( $sca) and $bo_table='BBS') $sca='원하는 카테고리';
else if (isset($sca)) {
$sca = mysql_real_escape_string($sca);
$qstr .= '&sca=' . urlencode($sca);
}

제가 써 놓은 소스와 알려주신 소스를 변경 하면 되는거죠?

해당 게시판에서 카테고리를 지정하지 않았을 경우
기본 카테고리를 지정하는 방법입니다.
common.php만 수정하시면 됩니다.