码桶
发现社区成员的开源项目
comments.php3.7 KB
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<section class="comments-area" id="comments">
<?php $this->comments()->to($comments); ?>
<?php if ($comments->have()): ?>
<h3 class="comments-title">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
</svg>
评论 (<?php $this->commentsNum(); ?>)
</h3>
<ol class="comment-list">
<?php $comments->listComments([
'avatarSize' => 48,
'dateFormat' => 'Y年m月d日',
'replyWord' => '回复',
]); ?>
</ol>
<?php $comments->pageNav('上一页', '下一页'); ?>
<?php endif; ?>
<?php if ($this->allow('comment')): ?>
<div class="comment-form-wrap" id="<?php $this->respondId(); ?>">
<h3 class="comment-form-title">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
发表评论
</h3>
<form method="post" action="<?php $this->commentUrl(); ?>" class="comment-form" role="form">
<input type="hidden" name="lb_platform" id="lb-platform" value="">
<?php if ($this->user->hasLogin()): ?>
<p class="comment-login-info">
已登录为 <a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>.
<a href="<?php $this->options->logoutUrl(); ?>">退出 »</a>
</p>
<?php else: ?>
<div class="comment-form-row">
<div class="comment-form-item">
<input type="text" name="author" id="author" class="form-input"
placeholder="昵称 *" value="<?php $this->remember('author'); ?>" required>
</div>
<div class="comment-form-item">
<input type="email" name="mail" id="mail" class="form-input"
placeholder="邮箱 *" value="<?php $this->remember('mail'); ?>"
<?php if ($this->options->commentsRequireMail): ?>required<?php endif; ?>>
</div>
<div class="comment-form-item">
<input type="url" name="url" id="url" class="form-input"
placeholder="网址" value="<?php $this->remember('url'); ?>">
</div>
</div>
<?php endif; ?>
<div class="comment-form-item">
<textarea name="text" id="textarea" class="form-textarea" rows="5"
placeholder="写下您的评论..." required><?php $this->remember('text'); ?></textarea>
</div>
<div class="comment-form-actions">
<?php $comments->cancelReply(); ?>
<button type="submit" class="submit-btn">提交评论</button>
</div>
</form>
</div>
<?php else: ?>
<div class="comments-closed">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
<path d="M7 11V7a5 5 0 0110 0v4"/>
</svg>
评论已关闭
</div>
<?php endif; ?>
</section>