[PHP]최신글 각각 뿌리는 방법 질문입니다 ㅠㅠ
본문
<div class="latest_page_width">
<style media="screen">
.latest_page_width{max-width:1280px;margin:0 auto;}
</style>
<!--문의게시판-->
<?php
echo latest('theme/latest_page', 'after', 5, 25);
?>
<!--공지사항-->
<?php
echo latest('theme/latest_page2', 'qa', 10, 25);
?>
</div>
이런식으로 진행했구요
실제 페이지는 이렇게 나옵니다.
후기게시판쪽은 잘되는데 문의게시판쪽은 최신글 불러오는게 되지 않네요 ㅠㅠ
폴더를 하나 더만들어서 별도로 적용하는 방법으로 진행 했습니다만... 실패했구요
하면 할수로 새롭게 뭔가 문제가 생기네요 ㅠㅠ
최신글 페이징 소스는 아래와 같습니다
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
?>
<!-- <?php echo $bo_subject; ?> 최신글 시작 { -->
<div class="lt_page_main">
<div class="lt_page">
<strong class="lt_page_title"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><?php echo $bo_subject; ?></a></strong>
<ul class="list_page">
<?php for ($i=0; $i<count($list); $i++) { ?>
<li>
<?php
//echo $list[$i]['icon_reply']." ";
echo "<a href=\"".$list[$i]['href']."\">";
if ($list[$i]['is_notice'])
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo $list[$i]['subject'];
if ($list[$i]['comment_cnt'])
echo $list[$i]['comment_cnt'];
echo "</a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new'];
if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot'];
if (isset($list[$i]['icon_file'])) echo " " . $list[$i]['icon_file'];
if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link'];
if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret'];
?>
</li>
<?php } ?>
<?php if (count($list) == 0) { //게시물이 없을 때 ?>
<li>게시물이 없습니다.</li>
<?php } ?>
</ul>
<div>
<button type="button">Prev</button>
<p>
<span>1</span>/<span></span>
</p>
<button type="button">Next</button>
</div>
</div>
</div>
<script>
$(function() {
$(".list_page + div > p > span:last-child").text(Math.ceil($(".list_page").children("li").size()/5));
$(".list_page > li").slice(0,5).addClass("on");
$(".list_page > li:nth-of-type(5n)").addClass("5n");
$(".list_page + div > button").click(function() {
var nav_list = $(this).parent("div").prev(".list_page");
if($(this).is(":last-child")) {
if(!$(nav_list).children("li:last").hasClass("on")) {
$(nav_list).children("li.on:last").nextUntil(".5n").addClass("on").next(".5n").addClass("on");
setTimeout(function() {
$(nav_list).children("li.on:first").removeClass("on").nextUntil(".5n").removeClass("on").next(".5n").removeClass("on");
});
var paging = ($(nav_list).children("li.on:last").index()+1)/5;
$(this).siblings("p").children("span:first-child").text(Math.ceil(paging));
}
}
else {
if(!$(nav_list).children("li:first").hasClass("on")) {
$(nav_list).children("li.on:first").prev(".5n").addClass("on").prevUntil(".5n").addClass("on");
setTimeout(function() {
$(nav_list).children("li.on:last").removeClass("on").prevUntil(".5n").removeClass("on");
});
var paging = ($(nav_list).children("li.on:first").index()+1)/5;
$(this).siblings("p").children("span:first-child").text(Math.ceil(paging));
}
}
});
});
</script>
<!-- } <?php echo $bo_subject; ?> 최신글 끝 -->
답변 3
리스트 자체가 안가져와진다면
스킨문제는 아닐거같은데요
qa가 게시판으로 만들어진건 맞나요?
스킨은 같은 것을 써도 됩니다.
<?php
echo latest('theme/latest_page', 'qa', 10, 25);
?>
사용 소스에 특별한 문제는 없습니다.
qa 게시판이 있는지, qa게시판에 작성된 게시글이 있는지, 게시글의 작성일이 최근인지 등을 체크해보면 될 듯 합니다.
echo latest('theme/latest_page', 'after', 5, 25);
echo latest('theme/latest_page2', 'qa', 10, 25);
순서를 바꾸면 아마 뒤에 것이 안 나올 듯합니다.
javascript 충돌 문제 아닐까 싶습니다.
브라우저 소스 보기하셔서 소스에도 해당 게시판 최신글" 부분이 안 나오는지 확인해 보세요.
답변을 작성하시기 전에 로그인 해주세요.