답변 3개
<?php
$gall_row_best = '';
if (isset($page) == false || $page == 1) {
$gall_row_best = 'gall_row_best';
}
?>
<style>
ul.gall_row_best li:nth-child(-n+10)::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 32px;
height: 32px;
background-image: url(best.png);
background-size: 100% 100%;
}
</style>
<ul id="gall_ul" class="gall_row <?php echo $gall_row_best; ?>">
<li>...</li>
...
</ul>
댓글을 작성하려면 로그인이 필요합니다.
단순히 $i 값 0 부터 9까지 10개의 게시물이 10위까지라고 할 수는 없겠죠
10번째 게시물 추천수 20개, 11번째 게시물 추천수 20개 라면 당연히 11번째 게시물도 best 일테니까요
다음처럼 해보세요
<?php
$prev_good = 1;
for ($i=0; $i<count($list); $i++) {
if($page==1 && ( ($list[$i]['wr_good']>0 && $i<10) || $list[$i]['wr_good'] == $prev_good) ){
$prev_good = $list[$i]['wr_good'];
?>
<label><img src="/skin/board/gall/img/best.png" style="width:30px;"></label>
<?php } ?>
댓글을 작성하려면 로그인이 필요합니다.
안녕하세요.
기존 list.skin.php 파일을 수정하시어 만드셔야 하는데요~
아래의 코드를 참고하시어 스킨을 수정해 보셔요~
<!-- 예시 -->
<ul class="post-list">
<?php for ($i=0; $i<count($list); $i++) {
$isBestPost = $i < 10; // 상위 1~10번째 게시물을 best.png로 표기
if ($isBestPost) { ?>
<li>
<img src="best.png" alt="best" class="best-icon">
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo $list[$i]['wr_subject'] ?>
</a>
</li>
<?php } else { ?>
<li>
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo $list[$i]['wr_subject'] ?>
</a>
</li>
<?php }
} ?>
</ul>
답변에 대한 댓글 2개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
[code]
<?php for ($i=0; $i<count($list); $i++) {
$isBestPost = $i < 10; // 상위 1~10번째 게시물을 best.png로 표기
if ($isBestPost) { ?>
<label><img src="/skin/board/gall/img/best.png" style="width:30px;"></label>
<?php } } ?>
[/code]
단순히
<label><img src="/skin/board/gall/img/best.png" style="width:30px;"></label>
이것만 추가해서 불러오고싶은데ㅠㅠ