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

페이지 정보

루루아빠 2,868 1 2015.04.24 03:09

평점

  • 평점 : 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
6
루루아빠 - 회원등급 : 최고관리자 - 포인트 : 1,291,261
레벨 96
경험치 1,390,416

Progress Bar 78%

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

댓글

첫 번째 댓글을 남겨 주세요

Total 7473238 페이지
제목 글쓴이 날짜 조회 추천
그누•영카트  댓글+1🏆 그누보드 5.4.2.8 shadow2fox 2020.08.14 1,600 1
그누•영카트  🏆 영카트 5.4.1.5 shadow2fox 2020.01.31 1,586 1
그누•영카트  댓글+1🏆 그누보드 5.4.4.2 shadow2fox 2021.01.05 1,582 1
그누•영카트  🏆 영카트 5.4.3 shadow2fox 2020.10.29 1,579 0
이윰  댓글+2🏆 View 페이지에서 이전글, 다음글 버튼에 제목과 썸네일을 가져오기 shadow2fox 2021.01.10 1,563 2
그누•영카트  댓글+2🏆 그누보드 5.4.5.1 shadow2fox 2021.02.06 1,536 2
그누•영카트  🏆 그누보드 5.4.3 shadow2fox 2020.10.29 1,532 0
그누•영카트  🏆 영카트 5.4.2.5.1 shadow2fox 2020.05.21 1,530 0
그누•영카트  🏆 영카트 5.4.2.8 shadow2fox 2020.08.14 1,515 0
PHP  댓글+2🏆 PHP 8.1.0 이용 시 그누보드 visit 관련 DB에서 MYSQL PHP Fatal error 루루아빠 2021.11.26 1,514 1
그누•영카트  🏆 영카트 5.4.1.4 shadow2fox 2020.01.08 1,501 1
그누•영카트  🏆 영카트 5.4.2.8.1 shadow2fox 2020.09.17 1,496 0
그누•영카트  🏆 영카트 5.4.3.1 shadow2fox 2020.11.24 1,482 0
그누•영카트  🏆 영카트 5.4.4.7.1 shadow2fox 2021.01.14 1,481 0
이윰  댓글+2🏆 글 작성 시 alt 태그 게시글 제목으로 DB에 저장하기 shadow2fox 2021.05.05 1,474 2
이윰  댓글+2🏆 이윰빌더 짧은주소를 그누보드 짧은주소로 교체하기 shadow2fox 2021.08.26 1,472 2
그누•영카트  댓글+2🏆 그누보드 5.4.5.3 shadow2fox 2021.04.05 1,459 2
이윰  댓글+2🏆 추천 베스트 최신글에서 블라인드 게시글은 제외하기 shadow2fox 2020.11.13 1,444 2
그누•영카트  🏆 영카트 5.4.4.7 shadow2fox 2021.01.14 1,441 0
그누•영카트  🏆 영카트 5.4.2.9 shadow2fox 2020.10.08 1,394 0