테스트 사이트 - 개발 중인 베타 버전입니다

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

나이왕고 4년 전 조회 1,858

</p>

<p><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></p>

<p>

 

이런식으로 진행했구요

 

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

 

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

 

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

 

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

 

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

 

</p>

<p><?php

if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>

<p>// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨

add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);

?></p>

<p><!-- <?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'];</p>

<p>            if ($list[$i]['comment_cnt'])

                echo $list[$i]['comment_cnt'];    

            echo "</a>";</p>

<p>            // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }

            // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }</p>

<p>            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></p>

<p><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; ?> 최신글 끝 --></p>

<p>

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

리스트 자체가 안가져와진다면

 

스킨문제는 아닐거같은데요

 

qa가 게시판으로 만들어진건 맞나요?

로그인 후 평가할 수 있습니다

답변에 대한 댓글 3개

나이왕고
4년 전
네 게시판에 글도 작성했구요 글이 없으면 게시글이 없습니다 라는 멘트가 나옵니다.
병원에서일해요
4년 전
관리자도구로 혹시 리스트가 가져와졌는데 숨김처리된건 아닌지 확인해보세요
나이왕고
4년 전
병원에서일해요님의 말씀에 힌트얻어 해결했습니다 ㅠㅠ
최신글페이징 스킨에 자바스크립트상 어떤 조건하에 리스트에 클래스on이 붙어야 글이 나오는데
원인은 알수 없지만 문의게시판에는 리스트에 클래스가 붙지 않아있었고, CSS에 리스트에 클래스가 붙어있지 않을시 display:none; ㅡ> display:list-item;으로 수정하여 해결했습니다

댓글을 작성하려면 로그인이 필요합니다.

    echo latest('theme/latest_page', 'after', 5, 25);
    echo latest('theme/latest_page2', 'qa', 10, 25);

순서를 바꾸면 아마 뒤에 것이 안 나올 듯합니다.

javascript 충돌 문제 아닐까 싶습니다.

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

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

4년 전

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

 

<?php
  echo latest('theme/latest_page', 'qa', 10, 25);
?>

 

사용 소스에 특별한 문제는 없습니다.

 

qa 게시판이 있는지, qa게시판에 작성된 게시글이 있는지, 게시글의 작성일이 최근인지 등을 체크해보면 될 듯 합니다.

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

나이왕고
4년 전
네 게시판에 글도 작성했구요 글이 없으면 게시글이 없습니다 라는 멘트가 나옵니다.
laatest_page라는 최신글 스킨으로 작업했습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인