menu article
Typecho comment enhancement plug-in: TeComment (updated on September 7, 2017)
Crimson seed visibility ninety-five thousand seven hundred and sixty-four star_border zero favorite_border one hundred comment sixty-five
enjoy happy life

TeComment (updated on September 7, 2017)

Typecho comment enhancement plug-in, which can add comment toolbar for Typecho comments, realize asynchronous loading of comment list, and submit comments with Ajax
Plug in address: TeComment

1. Installing plug-ins

  • After downloading the plug-in, confirm that the plug-in folder name is TeComment ,
  • Upload plug-in folder TeComment To site directory usr/plugins/
  • Enter the background and navigate Console>Plug ins Page, selecting enable TeComment plug-in unit

2. Using plug-ins

2.1 Comment Toolbar

After installing the plug-in, to display the comment toolbar, you need to modify the comments.php File:
stay textarea Insert the following code after the label (the placement position can be determined by yourself)

 <? php TeComment_Plugin::showTool();?>

2.2. Prerequisites for asynchronous loading with comment list or submitting comments with Ajax

Before enabling the asynchronous loading of comment list or Ajax comment submission function, you need to modify the functions.php File:

if functions.php Add or replace in file threadedComments The function is

 /** *Rewrite comment display function */ function threadedComments($comments, $options){ $html = TeComment_Plugin::parseCommentHtml($comments, $options); $children = ''; if ($comments->children) { ob_start(); $comments->threadedComments(); $children = ob_get_contents(); ob_end_clean(); } $html = str_replace('>{children}<','>'.$children.'<',$html); echo $html; }

2.3. Asynchronous loading of comment list

To enable the asynchronous loading of comments function, you need to modify the current theme's comments.php File:

code

 <? php $this->comments()->to($comments); ?> <? php if ($comments->have()): ?> <? php $comments->listComments(); ?> <? php $comments->pageNav('&laquo;  Previous', 'Next');?> <? php endif; ?>

Modify to

 <? php if($this->options->plugin('TeComment')->commentAjaxLoad): ?> <div id="comment-ajax-list" data-cid="<?php $this->cid();?> " data-num="<? php $this->commentsNum();?> " data-comment-page="<? php echo $this->request->commentPage;?>"></div> <? php else: ?> <? php $this->comments()->to($comments); ?> <? php if ($comments->have()): ?> <? php $comments->listComments(); ?> <? php $comments->pageNav('&laquo;  Previous', 'Next');?> <? php endif; ?> <? php endif; ?>

code

 <? php $comments->cancelReply(); ?>

Modify to

 <? php echo '<a id="cancel-comment-reply-link" href="' . $ this->permalink . '#' . $this->respondId . '" rel="nofollow"' .  ($this->request->filter('int')->replyTo ? '' : '  style="display:none"') . ' onclick="return TypechoComment.cancelReply(); ">'. _t ('cancel reply'). '</a>';?>

2.4. Ajax Submission Comments

To enable the 'Ajax submit comments' function, just enable' Ajax submit comments' on the plug-in settings page

This function is compatible with the default anti garbage protection function of the system

2.5. Comment template

In order to realize the asynchronous loading of comment lists and the Ajax submission of comments, the plug-in introduces comment templates. The default comment templates are:

 <li id="{theId}" class="widget {commentClass}"> <div class="comment-meta"> <div class="comment-meta-avatar">{authorAvatar}</div> <div class="comment-meta-author"> <strong>{beforeAuthor}<a href="{authorUrl}" rel="external nofollow" target="_blank">{authorName}</a>{afterAuthor}{commentStatus}</strong> </div> <div class="comment-meta-time">{beforeDate}{created}{afterDate}</div> <div class="comment-meta-reply">{replyLink}</div> </div> <div class="comment-content">{content}</div> <div class="comment-children">{children}</div> </li>

You can design your own comment template according to the needs of the template. The available parameters include:

  • {theId} Comment anchor ID
  • {commentClass} Comment list style
  • {authorAvatar} Comment on user profile
  • {authorName} Comment user name
  • {authorUrl} Comment user homepage
  • {authorUrl} Comment user email
  • {created} The comment publishing time is in the format set by the background
  • {replyLink} Link to reply to comments
  • {content} Comments
  • {children} Sub comments

Old version

Some time ago, a friend left a message on his blog about how to map comments. I just found myself wandering around Zhang Ge Blog The toolbar below the comment box may be useful. But its blog program is wordpress , can't use it, then write it yourself

Look at the renderings first:

 Comments Toolbar.png

The js effect part refers to Zhang Ge Blog Code in
In the toolbar, the function of emoticons is basically copied from Walking in Feathers Of Smilies Plug in, which can set the emoticon package used in the background

usage method:

 <? php TeComment_Plugin::showTool();?>

After enabling the plug-in comments.php Add the above code to the appropriate location of the file

Download address: TeComment

65 comments

Comments closed

Theme color
Accent color
Sign in
User name/mailbox cannot be empty
Password cannot be empty
User name cannot be empty
The mailbox cannot be empty
Login password cannot be empty
The verification code cannot be empty

Or use other methods to log in