Z-blogPHP Comment Beautify Tutorial

 Blogger: Li None but Li 2017-08-01 twelve thousand five hundred and eighteen 4 comments

 Beautify Comment.jpg

For days, I was tired and forced to blog. When I was bored, I saw an article in Tu Tuyan's blog to beautify the comments, and added a tutorial of "@ name" before replying to the message. I felt it was good. I tested it myself, and it was pretty good, as shown in the figure:

 Zbp Optimization Comment.png

If you like it, you can try to modify it yourself. Please backup it before modifying the template! Pay attention to backup! Primary Backup! Use FTP and other remote connection tools, open the website directory, find the theme template file comment.php, search for "{$comment. Content}" and add the following code in front of it:

 {if $comment.ParentID!=0} {php} $newc=$zbp->GetCommentByID($comment->ParentID); $atid=$newc->ID; $atname=$newc->Name; {/php} <a class="comment_at" href="#comment-{$atid}">@{$atname}</a> {/if}

Then, according to your own requirements, you can add css, and attach the css style of this site:

 a.comment_at {     padding: 2px 5px 3px 5px;     border: 1px solid #ddd;     border-radius: 4px;     color: #F35532; }

After all the modifications are completed, remember to go back to the background home page to "clear the cache and recompile the template";

Another one, I think it is also very interesting. It is also very simple to add "sofa", "bench" and "floor" courses to the comment floor.

The demonstration effect is shown as follows:

 Comments on Floor Optimization.png

Some comment codes are default, and some have been simply optimized by everyone, such as the N+1 floor. On this basis, judgment has been added. The tutorial is as follows; Or find the template file template file comment.php, find "{$key+1}" and replace the following code:

 {if $comment.ParentID==0} <span class="dot"> {if $key+1==1} sofa {elseif $key+1==2 } Bench {elseif $key+1==3 } floor {else} {$key+1} floor {/if} </span> {/if}

Then save, clear the cache, and add the corresponding CSS style yourself. Thanks to Tu Tuyan's blog for sharing. Those who like tossing, please start your performance.

The End

Published on: 2017-08-01, unless otherwise noted Li Yang's personal blog template demonstration station Original article, please indicate the source for reprinting.