优化一下评论列表加上@

This commit is contained in:
浪子 2024-06-13 15:30:11 +08:00
parent e69663dad4
commit a88130d5c5
2 changed files with 8 additions and 2 deletions

View File

@ -64,7 +64,6 @@
<?php $this->user->screenName(); ?></a>. <?php $this->user->screenName(); ?></a>.
<a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a></p> <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a></p>
<?php else: ?> <?php else: ?>
<p class="comment-form-author"> <p class="comment-form-author">
<input placeholder="称呼 *" type="text" name="author" id="author" class="text" value="" required /> <input placeholder="称呼 *" type="text" name="author" id="author" class="text" value="" required />
</p> </p>
@ -88,7 +87,6 @@
<?php else: ?> <?php else: ?>
<?php _e(''); ?> <?php _e(''); ?>
<?php endif; ?> <?php endif; ?>
<?php if ($comments->have()): ?> <?php if ($comments->have()): ?>
<?php $comments->listComments(); ?> <?php $comments->listComments(); ?>
<?php <?php
@ -152,6 +150,7 @@ function threadedComments($comments, $options) {
</div> </div>
</div> </div>
<div class="comment-content"> <div class="comment-content">
<?php if ($comments->parent) {echo getPermalinkFromCoid($comments->parent);}?>
<?php $comments->content(); ?> <?php $comments->content(); ?>
</div> </div>
</div> </div>

View File

@ -190,6 +190,13 @@ function img_postthumb($cid) {
return ""; // 没有匹配到图片URL返回空字符串 return ""; // 没有匹配到图片URL返回空字符串
} }
} }
//回复加上@
function getPermalinkFromCoid($coid) {
$db = Typecho_Db::get();
$row = $db->fetchRow($db->select('author')->from('table.comments')->where('coid = ? AND status = ?', $coid, 'approved'));
if (empty($row)) return '';
return '<a href="#comment-'.$coid.'" style="text-decoration: none;">@'.$row['author'].'</a>';
}
//开始增加某些奇怪的东西 //开始增加某些奇怪的东西
// 获取月份 // 获取月份
function getMonth() { function getMonth() {