채택완료

그누보드5 댓글 페이지기능요 ㅠㅠ

2019-03-16 (토) 19:33:01 2,818

안녕하세요 그누보드 초보입니다.

https://sir.kr/g5_tip/9995

요 링크에 보면요 댓글 페이징하는게 나오는데

그대로 따라했는데 페이징이 로그인 상태에서만 되고 비로그인 상태에서는 안되요 ㅠㅠ

css파일 적용때매 그런가 싶어서 폰으로 파이어폭스 설치하고 다운받은거 다지우고 생쑈를 해도 로그인 상태에서는 정상적으로 페이징되는데 비로그인상태에서는 안되네요 ㅠㅠ

도와주세요 ㅠㅠ

|

답변 2개 / 댓글 2개

채택된 답변
+20 포인트

@송상준

<script>
$(function(){
paging();
paging_nation();
});
var view_comment = 5;
function paging_nation()
{
$('.pagenation').on('click', function(e){
var Idx = $(this).index()+1;
var count = $('.a_comment').length;
var $a_comment = $('.a_comment');
var la_page = Idx * view_comment;
var fr_page = Idx * view_comment - view_comment;
$a_comment.slice(0).hide();
$a_comment.slice(fr_page, la_page).show();
console.log(fr_page, la_page);
$('.pagenation').removeClass('active');
$(this).addClass('active');
});
}
function paging()
{
var count = $('.a_comment').length;
var $a_comment = $('.a_comment');
$a_comment.slice(view_comment).hide();
var paging = '';
if(count>view_comment){
var totalpage = Math.floor(count/view_comment)+1;
for(var i=1;i<=totalpage;i++){
if(i==1)var active = "active";else var active='';
//paging += '<a href="javascript:;" class="pagenation" onclick="call_paging('+i+')">'+i+'</a>';
paging += '<a href="javascript:;" class="pagenation '+active+'">'+i+'</a>';
}
$('.paging').html(paging);
}
paging_nation();
}    
</script>
 

위에 소스를 view_comment.skin 파일 소스중 맨 하단 <?php } ?> 바로 밑으로 자리를 옮겨보세요..

답변에 대한 댓글 1개

조민님 정말 감사합니다 됩니다 ㅜㅜ 정말감사합니다 ㅜㅜㅜㅜㅜㅜ

이런식으로 출력 여부를 확인해 보세요..

해당 팁의 소스를 다 적용했는다는 가정하에...

view_comment.skin 파일 소스중

<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:<?php echo $cmt_depth ?>px;border-top-color:#e0e0e0"<?php } ?>>

위에 소스를 찾아서 아래의  소스를 찾은 소스 바로 윗줄에 추가해 보세요..


<div style="text-align: center">
<div class="paging"></div>
</div>

그럼 이렇게 되겠죠..

<div style="text-align: center">
<div class="paging"></div>
</div>

<article id="c_<?php echo $comment_id ?>" <?php if ($cmt_depth) { ?>style="margin-left:<?php echo $cmt_depth ?>px;border-top-color:#e0e0e0"<?php } ?>>

만약 비회원일때 출력한다면, 적용을 잘못한듯 싶네요...

답변에 대한 댓글 1개

해봤는데 역시나 로그인상태에서만 떠요 ㅠㅠ
비로그인상태에는 그대로에요 ㅠㅠ
ㅠㅠㅠㅠㅠㅠ

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