최신글에서 코멘트만 한줄로 출력이되는데 자꾸 코멘트 한개만 나와요. 채택완료

9년 전 조회 10,958

안녕하십니까?

디자이너플러스입니다.

 

최신글에서 코멘트만 한줄로 출력이 되는 스킨입니다. 

라이브러리도 코멘트 날리게 수정은 했구요.

코멘트도 잘 날라옵니다.

 

근데.. 문제는 5개 호출하면 코멘트 한개만 나오네요. ㅠㅠ 

 

아래는 전체 소스입니다.

Copy
<?phpif (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);?> <!-- <?php echo $bo_subject; ?> 최신글 시작 { --><div class="wz_tail_latest">    <dl id="olinenotice" class="notice">        <dd class="title"><?php echo $bo_subject; ?></dd>        <div class="notice-wrap">            <ul class="notice-ul">            <?php 			$count = count($list);				for ($i=0; $i<$count; $i++) {				$bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수 				$cmt_amt = count($list);			for ($i=0; $i<$cmt_amt; $i++) {				$comment_id = $list[$i]['wr_id'];				$cmt_depth = ""; // 댓글단계				$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 20;				$comment = $list[$i]['content'];				$comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);				$cmt_sv = $cmt_amt - $i + 1; 			for ($i=0; $i<count($list); $i++) {  			?>                <li>				<td class="td_subject">				<a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>" class="lat_cate_link">&nbsp;&nbsp;&nbsp;[<?php echo $bo_subject; ?>]</a> 				<a href="<?php echo $list[$i]['href']; ?>"><?php echo $list[$i]['subject']; ?></a>				<?php if ($list[$i]['wr_comment'] && !$comment_link) { ?><span class="new_comment"><?php echo $list[$i]['wr_comment'] ?></span><?php } ?>				<?php if ($list[$i]['datetime'] >= date("Y-m-d H:i:s", G5_SERVER_TIME - (24 * 3600))) echo '<img src="'.$latest_skin_url.'/img/icon_new.gif" alt="새글">'; ?>				</td>					<?php					$in_star_score_n = (int)$list[$i]['wr_1'];					if ( $in_star_score_n > 0 ) { 					?>						<div class="star_icon_div">							<span class="star_score_span" style="width:<?php echo ($in_star_score_n*20); ?>%"></span>						</div>						<td class="td_name">&nbsp;&nbsp;&nbsp;<?php echo $list[$i]['wr_name'] ?>&nbsp;&nbsp;&nbsp;</td>						<td class="td_date"><?php echo $list[$i]['datetime2'] ?></td>					<?php } ?> 				</li>			<?php } } } ?>            </ul>        </div>    </dl></div><!-- } <?php echo $bo_subject; ?> 최신글 끝 --> <script type="text/javascript"><!--    function fn_article(containerID, autoStart){         var $element = $('#'+containerID).find('.notice-ul');        var autoPlay = autoStart;        var auto = null;        var speed = 2000;        var timer = null;         var move = $element.children().outerHeight();        var first = false;        var lastChild;         lastChild = $element.children().eq(-1).clone(true);        lastChild.prependTo($element);        $element.children().eq(-1).remove();         if($element.children().length==1){            $element.css('top','0px');        }else{            $element.css('top','-'+move+'px');        }         if(autoPlay) {            timer = setInterval(moveNextSlide, speed);            auto = true;        }         $element.find('>li').bind({            'mouseenter': function(){                if(auto){                    clearInterval(timer);                }            },            'mouseleave': function(){                if(auto){                    timer = setInterval(moveNextSlide, speed);                }            }        }); 		function moveNextSlide(){		$element.each(function(idx){ 			var firstChild = $element.children().filter(':first-child').clone(true);			firstChild.appendTo($element.eq(idx));			$element.children().filter(':first-child').remove();			$element.css('top','0px'); 			$element.eq(idx).animate({'top':'-'+move+'px'},'normal'); 			});		}                }	window.onload = function() {         fn_article("olinenotice", true);     } //--></script> <?php //} ?>

 

이중 문제가 되는 코드는 아랫부분입니다.

Copy
<?php 			$count = count($list);				for ($i=0; $i<$count; $i++) {				$bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수 				$cmt_amt = count($list);			for ($i=0; $i<$cmt_amt; $i++) {				$comment_id = $list[$i]['wr_id'];				$cmt_depth = ""; // 댓글단계				$cmt_depth = strlen($list[$i]['wr_comment_reply']) * 20;				$comment = $list[$i]['content'];				$comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);				$cmt_sv = $cmt_amt - $i + 1; 			for ($i=0; $i<count($list); $i++) {  			?>

 

감사합니다.

답변 2개

채택된 답변
+20 포인트
count변수와 cmt_amt변수 개수를 찍어보세여

찍어보시고 5개가 맞다면 스킨문제구여

개수가 안맞다면 쿼리문제입니다

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

답변에 대한 댓글 2개

아 ㅠㅠ 찍어보니 1이네요 ㅠㅠ
정말 감사합니다. ㅠㅠ
우선 두 분께 진심으로 감사드립니다.

톰소여님이 변수값 체크하라구하여 1개만 들어간 것을 확인하고
쿼리문을 살펴보았는데 방도가 없어 DB접속해서 보니 ㅠㅠ
댓글이 1개만 올라가 있더라구요.

관리자 접속하여 최근게시물 삭제 일 수를 500000으로 변경하였습니다. ㅠㅠ

시간내주셔서 정말 감사합니다.

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

             for ($i=0; $i<$count; $i++) {
                 $bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수
                 $cmt_amt = count($list);
             for ($i=0; $i<$cmt_amt; $i++) {

 

변수가 둘다 $i 로 설정하셔서 그렇습니다.

 

1개를 $j로 바꾸시면 될꺼 같습니다.

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

답변에 대한 댓글 1개

변수를 바꿔도 똑같이 나오네요. ㅠㅠ

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

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

로그인
🐛 버그신고