fix comment number from all coments

This commit is contained in:
Jean-Christian Paul Denis 2023-01-05 01:13:55 +01:00
parent 3e9d931965
commit f01ab50e09
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,7 @@ dcCore::app()->tpl->addValue('ComListeNbCommentsPerPage', [tplComListe::class,'c
dcCore::app()->tpl->addBlock('ComListeCommentsEntries', [tplComListe::class,'comListeCommentsEntries']);
dcCore::app()->tpl->addValue('ComListePaginationLinks', [tplComListe::class,'comListePaginationLinks']);
dcCore::app()->tpl->addValue('ComListeOpenPostTitle', [tplComListe::class,'comListeOpenPostTitle']);
dcCore::app()->tpl->addValue('ComListeCommentOrderNumber', [tplComListe::class,'comListeCommentOrderNumber']);
dcCore::app()->tpl->addBlock('ComListePagination', [tplComListe::class,'comListePagination']);
dcCore::app()->tpl->addValue('ComListePaginationCounter', [tplComListe::class,'comListePaginationCounter']);
@ -236,6 +237,16 @@ class tplComListe
return __('open post');
}
public static function comListeCommentOrderNumber(ArrayObject $attr): string
{
return
'<?php echo ' .
'dcCore::app()->ctx->comments->index() + 1 +' .
'(dcCore::app()->public->getPageNumber() - 1) * ' .
'abs((integer) dcCore::app()->blog->settings->get("' . basename(__DIR__) . '")->get("nb_comments_per_page"));' .
'?>';
}
public static function comListePagination(ArrayObject $attr, string $content): string
{
$params = "<?php\n" .

View File

@ -33,7 +33,7 @@
<ul class="comments-list">
</tpl:CommentsHeader>
<li id="c{{tpl:CommentID}}" class="comment {{tpl:CommentIfMe}} {{tpl:CommentIfOdd}} {{tpl:CommentIfFirst}}">
<p class="comment-info">{{tpl:lang Source:}} <a href="{{tpl:CommentPostURL}}#c{{tpl:CommentID}}">{{tpl:CommentEntryTitle}}</a> - <a href="#c{{tpl:CommentID}}" class="comment-number">{{tpl:CommentOrderNumber}}</a> {{tpl:lang From}} {{tpl:CommentAuthorLink}} - <time datetime="{{tpl:CommentDate iso8601="1"}}">{{tpl:CommentDate format="%d"}}/{{tpl:CommentDate format="%m"}}/{{tpl:CommentDate format="%Y"}}, {{tpl:CommentTime}}</time>
<p class="comment-info">{{tpl:lang Source:}} <a href="{{tpl:CommentPostURL}}#c{{tpl:CommentID}}">{{tpl:CommentEntryTitle}}</a> - <a href="#c{{tpl:CommentID}}" class="comment-number">{{tpl:ComListeCommentOrderNumber}}</a> {{tpl:lang From}} {{tpl:CommentAuthorLink}} - <time datetime="{{tpl:CommentDate iso8601="1"}}">{{tpl:CommentDate format="%d"}}/{{tpl:CommentDate format="%m"}}/{{tpl:CommentDate format="%Y"}}, {{tpl:CommentTime}}</time>
</p>
<tpl:Block name="_entry-feedback-comments-comment-content">
<div class="comment-content">