스크랩 개수 출력하기 (view, list 페이지에 출력)
글 내용 보기 view.skin.php 파일에 출력하기.
1. 게시판 스킨 폴더에 있는 view.skin.php 파일 상단 ?> 안쪽에 아래 내용 추가
// 현재 글 스크랩 개수 구하기
$sql = " select count(*) as cnt from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' ";
$row = sql_fetch($sql);
$scrap_count = $row['cnt'];
1-1. view.skin.php 파일에서 스크랩 버튼 출력 부분을 이렇게 수정.
(추가된 부분 : <?php if($scrap_count > 0) echo "$scrap_count"; ?>)
<?php if ($scrap_href) { ?><a href="<?php echo $scrap_href; ?>" target="_blank" class="btn_b01" onclick="win_scrap(this.href); return false;">스크랩 <?php if($scrap_count > 0) echo "$scrap_count"; ?></a><?php } ?>
글 목록 list.skin.php 파일에 출력하기.
2. 게시판 스킨 폴더에 있는 list.skin.php 파일에서 for ($i=0; $i<count($list); $i++) { 바로 밑에 이렇게 추가
for ($i=0; $i<count($list); $i++) {
// 스크랩 개수 구하기
$sql = " select count(*) as cnt from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$list[$i]['wr_id']}' ";
$row = sql_fetch($sql);
$scrap_count = $row['cnt'];
2-1 list.skin.php 파일에서 출력하고 싶은 곳에 아래 내용 추가.
<?php echo $scrap_count ?>
참고 : http://sir.kr/g4_tiptech/542
1. 게시판 스킨 폴더에 있는 view.skin.php 파일 상단 ?> 안쪽에 아래 내용 추가
// 현재 글 스크랩 개수 구하기
$sql = " select count(*) as cnt from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' ";
$row = sql_fetch($sql);
$scrap_count = $row['cnt'];
1-1. view.skin.php 파일에서 스크랩 버튼 출력 부분을 이렇게 수정.
(추가된 부분 : <?php if($scrap_count > 0) echo "$scrap_count"; ?>)
<?php if ($scrap_href) { ?><a href="<?php echo $scrap_href; ?>" target="_blank" class="btn_b01" onclick="win_scrap(this.href); return false;">스크랩 <?php if($scrap_count > 0) echo "$scrap_count"; ?></a><?php } ?>
글 목록 list.skin.php 파일에 출력하기.
2. 게시판 스킨 폴더에 있는 list.skin.php 파일에서 for ($i=0; $i<count($list); $i++) { 바로 밑에 이렇게 추가
for ($i=0; $i<count($list); $i++) {
// 스크랩 개수 구하기
$sql = " select count(*) as cnt from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$list[$i]['wr_id']}' ";
$row = sql_fetch($sql);
$scrap_count = $row['cnt'];
2-1 list.skin.php 파일에서 출력하고 싶은 곳에 아래 내용 추가.
<?php echo $scrap_count ?>
참고 : http://sir.kr/g4_tiptech/542
첨부파일
댓글 4개
sinbi
8년 전
숫자가 표시되니까, 훨 멋지네용.
8년 전
궁굼했었는데...좋은정보 감사합니다.
플래너7580
7년 전
좋은 정보 감사합니다~
플래너7580
7년 전
한가지 문의 드립니다.
목록에 스크랩 칸을 하나 추가해서 조회순처럼 소팅을 적용하려고 아래처럼 소스를 수정했는데요.
[code]
<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">글쓴이</th>
<th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?>날짜 <i class="fa fa-sort" aria-hidden="true"></i></a></th>
<?php if ($is_good) { ?><th scope="col"><?php echo subject_sort_link('wr_good', $qstr2, 1) ?>추천 <i class="fa fa-sort" aria-hidden="true"></i></a></th><?php } ?>
<?php if ($is_nogood) { ?><th scope="col"><?php echo subject_sort_link('wr_nogood', $qstr2, 1) ?>비추천 <i class="fa fa-sort" aria-hidden="true"></i></a></th><?php } ?>
<th scope="col"><?php echo subject_sort_link('wr_hit', $qstr2, 1) ?>조회 <i class="fa fa-sort" aria-hidden="true"></i></a></th>
<th scope="col"><?php echo subject_sort_link('wr_scrap', $qstr2, 1) ?>스크랩 <i class="fa fa-sort" aria-hidden="true"></i></a></th>[/code]
이렇게 하니가 스크랩순으로 정렬이 안되던데 소스를 잘못 적용한건가영?
목록에 스크랩 칸을 하나 추가해서 조회순처럼 소팅을 적용하려고 아래처럼 소스를 수정했는데요.
[code]
<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">글쓴이</th>
<th scope="col"><?php echo subject_sort_link('wr_datetime', $qstr2, 1) ?>날짜 <i class="fa fa-sort" aria-hidden="true"></i></a></th>
<?php if ($is_good) { ?><th scope="col"><?php echo subject_sort_link('wr_good', $qstr2, 1) ?>추천 <i class="fa fa-sort" aria-hidden="true"></i></a></th><?php } ?>
<?php if ($is_nogood) { ?><th scope="col"><?php echo subject_sort_link('wr_nogood', $qstr2, 1) ?>비추천 <i class="fa fa-sort" aria-hidden="true"></i></a></th><?php } ?>
<th scope="col"><?php echo subject_sort_link('wr_hit', $qstr2, 1) ?>조회 <i class="fa fa-sort" aria-hidden="true"></i></a></th>
<th scope="col"><?php echo subject_sort_link('wr_scrap', $qstr2, 1) ?>스크랩 <i class="fa fa-sort" aria-hidden="true"></i></a></th>[/code]
이렇게 하니가 스크랩순으로 정렬이 안되던데 소스를 잘못 적용한건가영?
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4426 | ||
| 2694 | 2개월 전 | 194 | ||
| 2693 | 2개월 전 | 152 | ||
| 2692 | 2개월 전 | 160 | ||
| 2691 | 2개월 전 | 176 | ||
| 2690 | 2개월 전 | 328 | ||
| 2689 | 2개월 전 | 238 | ||
| 2688 |
|
2개월 전 | 442 | |
| 2687 | 2개월 전 | 294 | ||
| 2686 |
선택과집중
|
2개월 전 | 331 | |
| 2685 | 2개월 전 | 293 | ||
| 2684 | 2개월 전 | 353 | ||
| 2683 | 3개월 전 | 484 | ||
| 2682 | 3개월 전 | 279 | ||
| 2681 | 3개월 전 | 305 | ||
| 2680 |
선택과집중
|
3개월 전 | 278 | |
| 2679 | 3개월 전 | 333 | ||
| 2678 |
|
3개월 전 | 430 | |
| 2677 |
|
3개월 전 | 504 | |
| 2676 | 3개월 전 | 330 | ||
| 2675 | 3개월 전 | 307 | ||
| 2674 |
선택과집중
|
3개월 전 | 481 | |
| 2673 |
|
3개월 전 | 323 | |
| 2672 | 3개월 전 | 339 | ||
| 2671 | 3개월 전 | 287 | ||
| 2670 | 3개월 전 | 262 | ||
| 2669 | 3개월 전 | 374 | ||
| 2668 | 3개월 전 | 291 | ||
| 2667 |
선택과집중
|
3개월 전 | 487 | |
| 2666 |
선택과집중
|
3개월 전 | 472 | |
| 2665 |
선택과집중
|
3개월 전 | 411 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기