[PHP]최신글 각각 뿌리는 방법 질문입니다 ㅠㅠ

[PHP]최신글 각각 뿌리는 방법 질문입니다 ㅠㅠ

QA

[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>

 

이런식으로 진행했구요

 

실제 페이지는 이렇게 나옵니다.

 

30859202_1622098094.1313.png

후기게시판쪽은 잘되는데 문의게시판쪽은 최신글 불러오는게 되지 않네요 ㅠㅠ

 

폴더를 하나 더만들어서 별도로 적용하는 방법으로 진행 했습니다만... 실패했구요

 

하면 할수로 새롭게 뭔가 문제가 생기네요 ㅠㅠ

 

최신글 페이징 소스는 아래와 같습니다

 


<?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가 게시판으로 만들어진건 맞나요?

병원에서일해요님의 말씀에 힌트얻어 해결했습니다 ㅠㅠ
최신글페이징 스킨에 자바스크립트상 어떤 조건하에 리스트에 클래스on이 붙어야 글이 나오는데
원인은 알수 없지만 문의게시판에는 리스트에 클래스가 붙지 않아있었고, CSS에 리스트에 클래스가 붙어있지 않을시 display:none; ㅡ> display:list-item;으로 수정하여 해결했습니다

스킨은 같은 것을 써도 됩니다.

 

<?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 충돌 문제 아닐까 싶습니다.

브라우저 소스 보기하셔서 소스에도 해당 게시판 최신글" 부분이 안 나오는지 확인해 보세요.

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

회원로그인

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