XE(Rhymix)/변수 응용

추천수/댓글수로 평점 계산하기

TheStorybook 2025. 1. 29. 04:26
<block cond="$mid=='rank'">
   <div class="rankbox">
      {@
      $vote = $document->get('voted_count')?$document->get('voted_count'):0;
      $cmt = $document->getCommentCount()?$document->getCommentCount():0;
      //$star = (int)($vote/$cmt);
      //$star = round($voteDcmt?$voteDcmt:0,0);
      $star = $vote > 0 && $cmt > 0 ? $vote/$cmt : 0;
      }
      <div class="info_starpointCount{$star}">
         {$star}
      </div>
      
      <div class="ico_starpoint{(int)($star)}">
         {$star}
      </div>
      <div class="info_votecount">
         총 {$document->getCommentCount()?$document->getCommentCount():0}개의 평가
      </div>
   </div>
</block>