댓글이 없을때 0 으로 표시해주기!

  • SUHONE
  • 2015.01.02 20:24:37
  • 2

안녕하세요.


경로 


/public_html/widgets/content/skins/default/gallery.html


기본 컨텐츠 위젯을 조금 수정을 하다가요.

조회수, 댓글수, 추천수 구문을 삽입을 했습니다.


<ul class="widgetGalleryA" style="width:{$widget_info->cols_list_count*($widget_info->thumbnail_width+28)}px;">

    <!--@foreach($widget_info->content_items as $key => $item)-->

    <li<!--@if($_idx>0 && $_idx % $widget_info->cols_list_count==0)--> class="clearLeft"<!--@end--> style="<!--@if($_idx >= $widget_info->list_count)-->display:none;<!--@end-->width:{$widget_info->thumbnail_width}px;">

        <!--@foreach($widget_info->option_view_arr as $k => $v)-->

            <!--@if($v=='thumbnail')-->

                <a href="{$item->getLink()}" class="thumb" style="width:{$widget_info->thumbnail_width}px;height:{$widget_info->thumbnail_height}px" target="_blank"|cond="$widget_info->new_window">

                    <!--@if($item->getThumbnail())-->

                        <img src="{$item->getThumbnail()}" style="width:{$widget_info->thumbnail_width}px;height:{$widget_info->thumbnail_height}px"/>

                    <!--@else-->

                        <span class="imgNone">{$lang->none_image}</span>

                    <!--@end-->

                <!--@if($widget_info->show_browser_title=='Y' && $item->getBrowserTitle())-->

                    <strong class="board">{$item->getBrowserTitle()}</strong>

                <!--@end-->

                <!--@if($widget_info->show_category=='Y' && $item->getCategory())-->

                    <strong class="category">{$item->getCategory()}</strong>

                <!--@end-->

                </a>


            <!--@else if($v=='title')-->

                <div align="center"><a href="{$item->getLink()}" class="title" target="_blank"|cond="$widget_info->new_window">{$item->getTitle($widget_info->subject_cut_size)}</a></div>

                <div align="center" style="margin-top:5px; margin-bottom:10px;"><font size="2px"><b>{$item->get('readed_count')}</b>    <b>{$item->getCommentCount()}</b>    <b>{$item->get('voted_count')}</b></font></div>


        <!--@else if($v=='nickname')-->

<div align="right" style="margin-bottom:10px;">

<table border=0 width="100%" style='border-left:0;border-right:0;border-bottom:0;border-top:0'> 

  <tr> 

    <td width="70%">

            <a href="#" onclick="return false;" class="author member_{$item->getMemberSrl()}">{$item->getNickName($widget_info->nickname_cut_size)}</a></td>

        <!--@else if($v=='regdate')-->

            <td width="30%"><font size="2px"><b>{$item->getRegdate("m-d")}</b></font></td></tr></table></div>

        <!--@end-->

    <!--@end-->

    </li>

    <!--@end-->

</ul>


<!--@if($widget_info->page_count > 1 && $widget_info->list_count<$_idx)-->

<ul class="widgetNavigator">

    <li><button type="button" class="prev" title="{$lang->cmd_prev}" onclick="content_widget_prev(jQuery(this).parents('ul.widgetNavigator').prev('ul.widgetGalleryA'),{$widget_info->list_count})"><span>{$lang->cmd_prev}</span></button></li>

    <li><button type="button" class="next" title="{$lang->cmd_next}" onclick="content_widget_next(jQuery(this).parents('ul.widgetNavigator').prev('ul.widgetGalleryA'),{$widget_info->list_count})"><span>{$lang->cmd_next}</span></button></li>

</ul>

<!--@end-->


위 구문처럼 하니 추천수가 없을때는 0 으로 표시가 되는데 댓글수가 없을때는 0 으로 표시가 되질 않고 공백으로 나오는데 해결방법이 없을까요?

태그목록

  • 없음

첨부파일 목록

  • 없음
목록으로 돌아가기
댓글 쓰기
댓글 목록 [2]
  • sejin7940

    {(int)$item->getCommentCount()}

    댓글 2015-01-03

  • SUHONE

    세진님 감사합니다. ^^

    간단한 삽입으로 해결이 되었네요.

    기초가 없는 상태에서 이것저것 붙이면서 하다보니 어려움이 많습니다.

    새해복많이받으세요~

    댓글 2015-01-03