최신글에서 코멘트만 한줄로 출력이되는데 자꾸 코멘트 한개만 나와요.
본문
안녕하십니까?
디자이너플러스입니다.
최신글에서 코멘트만 한줄로 출력이 되는 스킨입니다.
라이브러리도 코멘트 날리게 수정은 했구요.
코멘트도 잘 날라옵니다.
근데.. 문제는 5개 호출하면 코멘트 한개만 나오네요. ㅠㅠ
아래는 전체 소스입니다.
<?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="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"> [<?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"> <?php echo $list[$i]['wr_name'] ?> </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 //} ?>
이중 문제가 되는 코드는 아랫부분입니다.
<?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
count변수와 cmt_amt변수 개수를 찍어보세여
찍어보시고 5개가 맞다면 스킨문제구여
개수가 안맞다면 쿼리문제입니다
찍어보시고 5개가 맞다면 스킨문제구여
개수가 안맞다면 쿼리문제입니다
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로 바꾸시면 될꺼 같습니다.
답변을 작성하시기 전에 로그인 해주세요.