게시판마다 본문속의 위젯을 다른 위젯명으로 출력하고 싶습니다.

게시판마다 본문속의 위젯을 다른 위젯명으로 출력하고 싶습니다.

QA

게시판마다 본문속의 위젯을 다른 위젯명으로 출력하고 싶습니다.

본문

안녕하세요.

하나의 게시판 스킨에 여러개의 게시판 타이틀이 있습니다.

게시판 본문에 최근 위젯이 들어가있는데요.

이게 게시판의 성향은 전부 다른데 스킨이 같다보니 전부 같은 최근위젯이 나와서 게시판 마다 스킨을 따로 만드는건 너무 무식한것 같아서요.

 

게시판마다 원하는 최근 위젯이 출력되게 하고싶습니다.

if else 구문으로 게시판 타이틀에 맞는 구문이 출력되게 하고싶습니다.

방법을 알려주시면 적용해보겠습니다.

감사합니다.

 

                    <div class="card-header">
                        <div class="d-flex justify-content-between align-items-center">
                            <h3 class="card-title font-weight-bold">
                                잠깐! 이번주 인기 게시물을 둘러보세요.
                            </h3>
                        </div>
                    </div>
                    <div class="card-body">
                        <?php echo na_widget('content_gallery', 'board_test', 'bo_list=board_test line=1 popover=1 icon=fa-download') ?>
                    </div>

 

위 소스 밖으로 게시판 타이틀별로 board_test 위젯명을 다르게 하고싶습니다.

이 질문에 댓글 쓰기 :

답변 2

content_gallery
이 최근글 스킨을 별도로 하나 복사하시고 아이디는 같은걸로 한뒤

내부에서 bo_table 가져오는 구분만 $_GET['bo_table'] 처리를 하면 될거에요.

힌트주셔서 감사합니다.

<?php if($bo_table == 'board_5'){ ?>
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h3 class="card-title font-weight-bold">
잠깐! 이번주 인기 게시물도 둘러보세요.
</h3>
</div>
</div>
<div class="card-body">
<?php echo na_widget('content_gallery', 'board_5', 'line=1 popover=1 icon=fa-download') ?>
</div>
<?php } ?>

식으로 해결했습니다.

<?php if($bo_table == 'board_5'){ ?>
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h3 class="card-title font-weight-bold">
잠깐! 이번주 인기 게시물도 둘러보세요.
</h3>
</div>
</div>
<div class="card-body">
<?php echo na_widget('content_gallery', 'board_5', 'line=1 popover=1 icon=fa-download') ?>
</div>
<?php } ?>

 

이렇게 하셔도 되고

 

$latestboid = '보드ID';

// URL 에 bo_table 이 선언되어 있다면 if 없이 GET 으로 해당 보드를 가져올수 있습니다.

// $latestboid = $_GET['bo_table'];

 

if($latestboid){ // bo_table 값이 있다면

echo na_widget('content_gallery', $latestboid, 'line=1 popover=1 icon=fa-download');

}

 

답변을 작성하시기 전에 로그인 해주세요.
전체 30
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT