묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
최신글 목록 코드를 짰는데 댓글 수 표시하는 방법 좀 알려주세요
2013.05.14 16:53
<!-- 반복문 시작 -->
<? if(count($All)>0) {
foreach($All as $key => $all_value){?>
<tr>
<? if($all_value['idx']==0 || $all_value['idx']==8 || $all_value['idx']==16) { ?>
<td class="IMG" rowspan="8"><a href="{getUrl('mid',<?=$all_value['module_info']->mid?>,'document_srl',<?=$all_value['document_srl']?>)}"><img src="<?=$all_value['thumbnail']?>" id="ListIMG0" /></a></td>
<? } ?>
<td class="List" onMouseOver="OverChange('<?=$all_value['thumbnail']?>','0')">
<span class="Category"><?=$all_value['module_info']->browser_title?></span>
<span class="Title">
<a href="{getUrl('mid',<?=$all_value['module_info']->mid?>,'document_srl',<?=$all_value['document_srl']?>)}" onmouseover="jQuery('#ListIMG0').parent().attr('href','{getUrl('mid',<?=$all_value['module_info']->mid?>,'document_srl',<?=$all_value['document_srl']?>)}')"><?=$all_value['title']?></a></span>
<span>
{@
$commentModel = &getModel('comment');
$commentCount = $commentModel->getCommentCount($all_value['document_srl']);
}
{$commentCount}
</span>
</td>
</tr>
<? } //foreach end
} ?>
<!-- 반복문 종료 -->{@
$commentModel = &getModel('comment');
$commentCount = $commentModel->getCommentCount($all_value['document_srl']);
}
{$commentCount}
이건 송동우님께서 예전에 어떤글에 답변해주신겁니다.
문서srl 을 알 때 댓글 갯 수 표시할 수 있는거라고 해서
$all_value['document_srl']이 문서 번호길래 넣어봤는데
이렇게 하면 댓글 수가 안나오고 동일한 365478 가 나오는데요 어떻게 해야 될까요?
방금은 365479로 바뀌었네요..
이 코드가 어디에 위치하는지는 잘 모르겠으나 보통 xe 에서는
if 문이나 foreach 문은 xe 문법을 사용하셔야 합니다.
<? 라던가 ?> 는 사용하지 않습니다.