Extra Form
PHP PHP 7.3
CMS XpressEngine1
xe - modules - board - skins - sketchbook5 - _comment.html 열고            
최상단에
{@
 $oDB = &DB::getInstance();
 $query = $oDB->_query('select regdate from xe_comments where document_srl = '.$document_srl);
 $result = $oDB->_fetch($query);
 $no = array();
}
<block loop="$i=0;$i<count($result);$i++">
{@ $no[] = $result[$i]->regdate}
</block>
{@ sort($no)}
이것 입력..

그리고

 

line 24 쯤에
<!--// 댓글 정보 -->
<div class="meta">
이것을

 

<block loop="$no => $k,$v" cond="$v==$comment->get('regdate')">
{@ $k++}
<? break ?>
</block>
<!--// 댓글 정보 -->
<div class="meta">{$k}
이것으로 수정

출처: https://xe1.xpressengine.com/qna/21136497

 

위의 방법으로 적용하면 댓글이 3개 이하일때 페이지가 오류가 나고 댓글 3개 이상이면 번호가 잘 달립니다.

왜그런지는 모르겠습니다...

 

https://xetown.com/tips/1075021

위 방법으로 해보았는데도 아예 출력이 안되고 적용이 되지 않습니다.

 

방법을 알고싶습니다.

  • profile

    이렇게 해보세요.

    {@
        $oDB = &DB::getInstance();
        $query = $oDB->_query('select comment_srl from xe_comments where document_srl = '.$document_srl.' order by regdate');
        $result = $oDB->_fetch($query);
    
        $no = array();
        foreach($result as $k => $c):
            $no[$c->comment_srl] = $k;
        endforeach;
    }

     

    그리고 댓글 목록 안에

    {$no[$comment->comment_srl]+1}

    를 넣어주면 될 것 같습니다.

  • profile profile
    • form
    • 질문기여자
    감사합니다. 해결되었습니다^^