[이윰] "카테고리"별 게시글 갯수 나타내기

페이지 정보

yadolee 루루아빠 3,108 1 2015.04.24 03:09:55

평점

  • 평점 : 0점 (0명 참여)

본문

eyoom/user_program/board/list.skin.php 을 열어 다음 소스로 덮어 씌운다.


<?php
    if (!defined('_GNUBOARD_')) exit;
    // Your Program - Start

    // 카테고리
    if ($board['bo_use_category']) {
        foreach($categories as $key => $val) {
            $bocate[$key]['ca_name'] = trim($val);
                $sql_ca = " SELECT count(*) as caCount FROM {$write_table} WHERE ca_name = '{$bocate[$key][ca_name]}' and wr_is_comment = 0 ";
                $row_ca = sql_fetch($sql_ca);
                $bocate[$key]['ca_cnt'] =  $row_ca['caCount'];
                $tot_cate_cnt += $row1['caCount'];
        }
        // 게시판 전체 글수를 "전체(nnn)"에 표시하고자 할 경우 (공지 글도 포함이 됨)
        $total_row = sql_fetch(" select sum(bo_count_write) as cnt from {$g5[board_table]} where bo_table = '{$bo_table}' ");
        $total_cate_cnt = $total_row['cnt'];

        // 카테고리가 있는 게시글 수를 "전체(nnn)"에 표시하고자 할 경우 (공지 글, 카테고리가 없는 글은 제외 됨)
        // $total_cate_cnt = $tot_cate_cnt;

    }

    // Your Program - End

    // 변수 할당하기 - /eyoom/inc/tpl.assign.php 파일 참조
    $tpl->assign(array(

    ));
?>

각 일반 게시판 스킨 폴더 중 list.skin.html을 열어 다음 소스를 보고 확인 수정한다.
※ 카테고리 탭 형식일때

    <!--{* 게시판 카테고리 시작 *}-->
    <!--{?_is_category}-->
    <div class="tab-cart">
    <!--{    <h5><strong class="color-red">{board.bo_subject}</strong> 카테고리</h5>    *}-->
    <div class="margin-hr-10"></div>
        <div class="row col-sm-12">
            <ul class="nav nav-tabs">
                <li class="{?!_decode_sca}active{/}">
                    <a href="{_category_href}">전체 <span class="" title="전체글 갯수"><font size="2">({_total_cate_cnt})</font></span></a>
                </li>
                <!--{@ _bocate}-->
                <li class="{? _decode_sca == .ca_name}active{/}">
                    <a href="{_category_href}&sca={.ca_sca}">{.ca_name} <span class="" title="{.ca_name} 게시글 갯수"><font size="1"><em>({.ca_cnt})</em></font></span></a>
                </li>
                <!--{/}-->
            </ul>
        </div>
    </div>
    <div class="clearfix"></div>

    <div class="margin-hr-10"></div>

    <!--{/}-->
    <!--{* 게시판 카테고리 끝 *}-->

※ 카테고리 기본(드랍다운) 형식일때

    <!-- 게시판 카테고리 시작 { -->
    <!--{?_is_category}-->
    <script>
    // 카테고리 이동
    function category_view(sca) {
        if(sca)    var url = "{_category_href}&sca="+sca;
        else var url = "{_category_href}";
        $(location).attr('href',url);
        return false;
    }
    </script>
    <nav>
        <h5><strong class="color-red">{board.bo_subject}</strong> 카테고리</h5>
        <div class="row col-sm-4">
            <select name="ca_name" id="ca_name" required class="form-control" onchange="return category_view(this.value);">
                <option value="">전체 <font size="1"><em>({_total_cate_cnt})</em></font></option>
                <!--{@ _bocate}-->
                <option value="{.ca_sca}" {? _decode_sca == .ca_name}selected{/}>{.ca_name} <font size="1"><em>({.ca_cnt})</em></font></option>
                <!--{/}-->
            </select>
        </div>
        <div class="clearfix"></div>
    </nav>
    <div class="margin-hr-10"></div>
    <!--{/}-->
    <!-- } 게시판 카테고리 끝 -->

추천인 1
  • shadow2fox
    shadow2fox
yadolee
6
루루아빠 - 회원등급 : 최고관리자 - 포인트 : 1,332,364
레벨 100
경험치 1,487,363

Progress Bar 7.88%

- 가입일 : 2015-03-04 03:24:54
- 서명 : KNOW YOUR LIMITS BUT NEVER STOP TRYING TO EXCEED THEM !!
- 자기소개 : 루루의 자랑 루루아빠랍니다~~

댓글

첫 번째 댓글을 남겨 주세요

Total 7623339 페이지

제목 글쓴이 날짜 조회 추천
그누•영카트  댓글+2🏆 그누보드 5.4.5.4 shadow2fox 2021.05.04 1,689 2
그누•영카트  댓글+2🏆 그누보드 5.4.5.3 shadow2fox 2021.04.05 1,686 2
그누•영카트  🏆 영카트 5.4.3.1 shadow2fox 2020.11.24 1,676 0
그누•영카트  🏆 영카트 5.4.4.9.1 shadow2fox 2021.02.06 1,673 0
그누•영카트  🏆 영카트 5.4.4.7 shadow2fox 2021.01.14 1,671 0
그누•영카트  🏆 영카트 5.4.2.8.1 shadow2fox 2020.09.17 1,668 0
그누•영카트  🏆 영카트 5.4.4.8 shadow2fox 2021.01.19 1,663 0
그누•영카트  🏆 영카트 5.4.5.4 shadow2fox 2021.05.04 1,649 0
그누•영카트  🏆 영카트 5.4.4.9 shadow2fox 2021.01.26 1,632 0
그누•영카트  댓글+2🏆 그누보드 5.4.5.5 shadow2fox 2021.05.18 1,630 2
그누•영카트  댓글+1🏆 그누보드 5.4.4.6 shadow2fox 2021.01.12 1,605 1
에디터  댓글+2🏆 CKEditor 4.x 버전 체크로 인한 콘솔 에러 해결하기 shadow2fox 2023.12.24 1,600 3
그누•영카트  🏆 영카트 5.4.4.5 shadow2fox 2021.01.09 1,589 0
이윰  댓글+2🏆 글, 댓글 작성시 불필요한 앞뒤 공백 제거해 DB에 저장하기 shadow2fox 2021.06.21 1,579 2
그누•영카트  댓글+2🏆 그누보드(영카트) 5.4.13 shadow2fox 2021.07.28 1,573 2
JavaScript  댓글+2🏆 Prism.js 플러그인 Copy to Clipboard Button 이용 시 빈칸이 추가되는 문제 해결하기 shadow2fox 2021.06.22 1,562 2
그누•영카트  🏆 영카트 5.4.5.1 shadow2fox 2021.02.06 1,528 0
그누•영카트  🏆 영카트 5.4.4.6 shadow2fox 2021.01.12 1,523 0
그누•영카트  댓글+2🏆 그누보드(영카트) 5.4.16 shadow2fox 2021.09.24 1,522 2
그누•영카트  댓글+4🏆 그누보드 5.4.6 (영카트 포함) shadow2fox 2021.06.18 1,493 2