게시판 글보기 페이지 화면에서 " 최근 24시간 내 새로 등록된 댓글이 있다면.. " 이라는 조건문이 혹시 있을까요?

 

[ 글보기 화면 ]

 

작성글

 댓글1

 댓글2

  ...

  • profile
    쿼리문을 새로 만들어야 할 것 같습니다.
    해당 게시물idx에 해당하는 코멘트 중 작성일이 현재-24시간보다 큰것으로 조건을 걸어서 카운트를 하거나 그 결과를 가져오면 되죠.
  • profile ?
    답변감사합니다.
    혹시 간단한 조건문이 아닌가 하는 생각에 문의를 드렸는데 간단하게 처리될 부분이 아닌것 같습니다. ^^
  • profile
    if($this->get('regdate')>$time_check == "new")
    제가 XE를 잘 몰라서 이게 될지 안될지 모르겠네요.
  • profile ?

    답변감사합니다. ^^

    https://martmonster.com/index.php?mid=seoul&document_srl=2027&read_review_tab=evaluation

    에서 보면 행사&소식 탭 아래 내용이 일반 게시판의  댓글 부분인데요.

    새로운 댓글이 있을 경우 탭 제목( 행사&소식 ) 옆에 new 아이콘을 붙여보려고 시도 하고 있습니다.

     

    <div class="review_tab">
      <ul class="rtab_sub">
        <li class="first"<!--@if(!$read_review_tab || $read_review_tab=='board_read')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','board_read')}">전단지</a></li>
        <li <!--@if($read_review_tab=='evaluation')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','evaluation')}">행사소식 ( 새로운 댓글 있다면 new아이콘 표시 )</a></li>
        <li<!--@if($read_review_tab=='map')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','map')}">지도</a></li>    
      </ul>

    </div>


    말씀 해 주신 팁이 적용이 잘 되질 않는데  계속 시도 해보고 추후라도 적용이 되면 피드백 드리겠습니다.

  • profile

    getCommentCountByRegdate.xml

     

    해당 파일을 ./modules/comment/queries 폴더에 넣어주시구요.

    ./modules/comment/comment.model.php 파일의 commentModel 클래스에 아래 함수를 추가해 주세요.


    function getCommentCountIn24HByDocument($document_srl)
    {
     $args = new stdClass();
     $args->document_srl = $document_srl;
     $args->regdate = date("YmdH", $_SERVER['REQUEST_TIME'] - 24 * 60 * 60);
     $output = executeQuery('comment.getCommentCountByMemberSrl', $args);
     return (int) $output->data->count;
    }

     

    클래스 내부 함수 추가방법을 모르시면, 그냥 해당 파일 제일 마지막 괄호 바로 위에 넣어주시면 됩니다.

    괄호 2개 있는데 그 사이에 넣으시면 됩니다.

     

    이후, 24시간 이내 댓글을 확인해야 하는 부분에서 아래 방식을 통해 확인해 주시면 됩니다.

     

    {@

      $oCommentModel = getModel('comment');

      $24HCount = $oCommentModel->getCommentCountIn24HByDocument($oDocument->document_srl);

      $isExistsIn24H = count($24HCount) > 0;

    }

    <block cond="$isExistsIn24H">24시간 이내 댓글 존재</block>

    <block cond="!$isExistsIn24H">24시간 이내 댓글 미존재</block>

     

     

    --

    작동 확인 여부는 확인을 해 보지 않아 장담드리기는 힘듭니다ㅠ

    Atachment
    첨부
  • profile ?

    답변 진심 감사드립니다.^^

    말씀 해 주신 첫단계와 두번째 단계에서는 에러가 없구요. 
    세번째단계 내용을 아래와 같이 넣으면

    <div class="review_tab">
      <ul class="rtab_sub">
        <li class="first"<!--@if(!$read_review_tab || $read_review_tab=='board_read')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','board_read')}">전단지</a></li>
        <li <!--@if($read_review_tab=='evaluation')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','evaluation')}">행사소식    
        
    {@
      $oCommentModel = getModel('comment');
      $24HCount = $oCommentModel->getCommentCountIn24HByDocument($oDocument->document_srl);
      $isExistsIn24H = count($24HCount) > 0;
    }

    <block cond="$isExistsIn24H">24시간 이내 댓글 존재</block>
    <block cond="!$isExistsIn24H">24시간 이내 댓글 미존재</block>
        
        </a></li>
        <li<!--@if($read_review_tab=='map')--> id="evar_on"<!--@end-->><a href="{getUrl('read_review_tab','map')}">지도</a></li>    
      </ul>
    </div>


    을 제가 표시하고자 하는 위치에 넣으면 아래와 같은 에러가 발생이 됩니다. ^^;

     

    Parse error: syntax error, unexpected '24' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in /tqooktest/www/classes/template/TemplateHandler.class.php(436) : eval()'d code on line 209

     

    {@
      $oCommentModel = getModel('comment');
      $24HCount = $oCommentModel->getCommentCountIn24HByDocument($oDocument->document_srl);
      $isExistsIn24H = count($24HCount) > 0;
    }

    이 부분을 제거하면 에러가 발생치 않습니다. ^^;

  • ? profile
    이런 단순한 실수를...ㅋㅋㅋ 제가 바보였네요ㅠ

    {@
    $oCommentModel = getModel('comment');
    $cCount = $oCommentModel->getCommentCountIn24HByDocument($oDocument->document_srl);
    $isExistsIn24H = count($cCount) > 0;
    }

    이렇게 수정해 보시겠어요?
  • profile ?

    넵 감사합니다. 말씀 해 주신 부분으로 하니 에러 문제가 해결되었습니다. ^^

     

    제가 괜한 부담을 드리는게 아닐지 우려가 되는데요. 
    댓글이 아예 없는 경우와 24시간 이내 댓글이 없는 경우에도 "24시간 댓글 존재"로 메세지기 표시되는데 조건문이 적용이 안되는것 같습니다. ^^;

    댓글이 아예 없는 경우입니다. http://tqooktest.cafe24.com/index.php?mid=seoul&document_srl=267&read_review_tab=evaluation

    24시간 이전 댓글만 있는 경우입니다.
    http://tqooktest.cafe24.com/index.php?mid=seoul&document_srl=207&read_review_tab=evaluation