CMS/그누보드

그누보드 게시판 분류 (catogory)

*category 소스

<!-- 게시판 카테고리 시작 { -->
    <?php if ($is_category) { ?>
    <nav id="bo_cate">
        <h2><?php echo $board['bo_subject'] ?> 카테고리</h2>
        <ul id="bo_cate_ul">
            <?php echo $category_option ?>
        </ul>
    </nav>
    <?php } ?>
    <!-- } 게시판 카테고리 끝 -->

- css 상속 피하기 : 카테고리 맨 위에 id로 하나 감싸서 재상속시키거나, id자체를 지워버려도 됨 

 

 

*category active되었을때 a의 id 바꾸기  // css상속 때문

-/bbs/list.php

// 분류 사용 여부
$is_category = false;
$category_option = '';
if ($board['bo_use_category']) {
    $is_category = true;
    $category_href = G5_BBS_URL.'/board.php?bo_table='.$bo_table;

    $category_option .= '<li><a href="'.$category_href.'"'; //--> here!
    if ($sca=='')
        $category_option .= ' id="port_tab_active"';
    $category_option .= '>전체</a></li>';

    $categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음
    for ($i=0; $i<count($categories); $i++) {
        $category = trim($categories[$i]);
        if ($category=='') continue;
        $category_option .= '<li><a href="'.($category_href."&amp;sca=".urlencode($category)).'"';
        $category_msg = '';
        if ($category==$sca) { // 현재 선택된 카테고리라면
            $category_option .= ' id="port_tab_active"';   //--> here!
            $category_msg = '<span class="sound_only">열린 분류 </span>';
        }
        $category_option .= '>'.$category_msg.$category.'</a></li>';
    }
}

 

 

*분류별 게시물 갯수 출력 스킨

    //전체 & 다른 카테고리 active 연동 안되는 스킨

<?php if ($is_category) { ?>
						<ul class="port_tab">
							<li>
								<? if (!$sca){?>
									<a id="all_current" href='./board.php?bo_table=<?=$bo_table?>'>All
									<?
										$total=sql_fetch("select  sum(bo_count_write ) as cnt from $g5[board_table] where bo_table IN('$bo_table')");
										echo "<em>$total[cnt]</em>";
									?>
								<?}else{?>
									<a id="all_current" href='./board.php?bo_table=<?=$bo_table?>'>All
									<?
									$total=sql_fetch("select  sum(bo_count_write ) as cnt from $g5[board_table] where bo_table IN('$bo_table')");
									echo "<em>$total[cnt]</em>";
									?>
								<?}?>
									</a>
							</li>
								<? if ($is_category) { ?><?  
									$cnt = 1;
									$cnt0 = 0;
									$bb_s=""; $bb_e="";
									$arr = explode("|", $board[bo_category_list]); // 구분자가 , 로 되어 있음
									$str = "";
									$str .= "";
									$f_open="id=current";
									$f_close="";
										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);
													if ($sca == $arr[$i]) { $cnt0++; $b_s="";$cc=$f_open; $b_e=""; } else {$b_s=""; $cc=$f_close; $b_e="";}
														if ($sca == $arr[$i]) {
															$str .= "<li class=first><a $cc href='./board.php?bo_table=$bo_table&sca=" . rawurlencode($arr[$i]) . "'>$b_s$arr[$i]$b_e <em>$row1[cCount]</em></a></li>"; }
														else {
															$str .= "<li class=first><a $cc href='./board.php?bo_table=$bo_table&sca=" . rawurlencode($arr[$i]) . "'>$b_s$arr[$i]$b_e <em>$row1[cCount]</em></a></li>"; } 
															$cnt++;
										    }
											if ($cnt0 == 0 ) { $bb_s="<b>"; $bb_e="</b>"; }
									?>
								<?=$str?>
								<? } ?>
							<?php } ?>
						</ul>

- 변수 $total[cnt] / $row1[cCount] 가 숫자 부분