让DEDE评论盖楼像腾讯 网易一样显示的如何实现方法

生活的激流已经涌现到万丈峭壁,只要再前进一步,就会变成壮丽的瀑布。没有播种,何来收获;没有辛苦,何来成功;没有磨难,何来荣耀;没有黯淡,何来辉煌。

 

DEDE评论效果:

修改后的效果:

预览地址:http://www.spenews.com/news/android-girl.html

修改步骤

一、5.5版本(5.6版本请往下看)
1、修改/plus/feedback_ajax.php文件的第131行(如果你没改过)
下面是修改之前的代码:

  1.  
  2. $qmsg = ‘{quote}{title}’.$row['username'].’ 的原帖:{/title}{content}’.$row['msg'].’{/content}{/quote}’;  

下面是修改后的代码:

  1.  
  2. //$qmsg = ‘{quote}{title}’.$row['username'].’ 的原帖:{/title}{content}’.$row['msg'].’{/content}{/quote}’;
  3. $floors = substr_count($row['msg'], ‘{title}’);//查找评论中楼层数
  4. if ($floors > 0) {
  5.     $floors += 1;
  6.     $floor_html = ‘{floor}’ . $floors . ‘{/floor}’;
  7. }
  8. else {
  9.     $floor_html = ‘{floor}1{/floor}’;
  10. }
  11. $quotetitle = ‘{title}引用’ . $row['username'] . ‘的评论’. $floor_html .’{/title}’;
  12. $oldquote = ”;//以前的引用
  13. $quotemsg = $row['msg'];
  14. if ($floors > 0) {
  15.     $oldquoteend = strrpos($quotemsg, ‘{/quote}’) + 8;
  16.     $oldquote = substr($quotemsg, 0, $oldquoteend);
  17.     $quotemsg = substr($quotemsg, $oldquoteend);
  18. }
  19. $qmsg = ‘{quote}’ . $oldquote . $quotetitle . ‘{content}’ . $quotemsg . ‘{/content}{/quote}’;

2、在/include/channelunit.func.php文件的516行,就是在return $quote;代码前插入两行代码
下面是修改之前的代码:

  1.  
  2. return $quote;

下面是修改之后的代码:

  1.  
  2. $quote = str_replace(‘{floor}’,’<span class="floor">’,$quote);
  3. $quote = str_replace(‘{/floor}’,’</span>’,$quote);
  4. return $quote;

3、在/templets/style/dedecms.css文件末尾加入下面的CSS代码(任意位置均可)

  1.  
  2. .floor {
  3.     float:right;
  4.     padding-right:10px;
  5. }

4、PHP技术有限,有更好的实现方法请指正,经以上修改失败请回帖,修改成功后记得顶个贴^_^

二、5.6版本
1、修改/templets/plus/feedback_quote.htm文件的第94行(如果你没改过)
下面是修改之前的代码:

  1.  
  2. <input type="hidden" name="quotemsg" value="{quote}<?php echo ‘{title}’.$row['username'].’ 的原帖:{/title}{content}’.$row['msg'].’{/content}’; ?>{/quote}" /> 

下面是修改后的代码:

  1.  
  2. <input type="hidden" name="quotemsg" value="<?php
  3. //echo ‘{quote}{title}’.$row['username'].’ 的原帖:{/title}{content}’.$row['msg'].’{/content}{/quote}’;
  4. floors = substr_count($row['msg'], ‘{title}’);//计算评论中楼层数
  5. if ($floors > 0) {
  6.     $floors += 1;
  7.     $floor_html = ‘{floor}’ . $floors . ‘{/floor}’;
  8. }
  9. else {
  10.     $floor_html = ‘{floor}1{/floor}’;
  11. }
  12. $quotetitle = ‘{title}’ . $row['username'] . ‘的原帖’. $floor_html .’{/title}’;
  13. $oldquote = ”;//以前的引用
  14. $quotemsg = $row['msg'];
  15. if ($floors > 0) {
  16.     $oldquoteend = strrpos($quotemsg, ‘{/quote}’) + 8;
  17.     $oldquote = substr($quotemsg, 0, $oldquoteend);
  18.     $quotemsg = substr($quotemsg, $oldquoteend);
  19. }
  20. echo ‘{quote}’ . $oldquote . $quotetitle . ‘{content}’ . $quotemsg . ‘{/content}{/quote}’;
  21. ?>" />

2、在/include/channelunit.func.php文件的519行,就是在return $quote;代码前插入两行代码
下面是修改之前的代码:

  1.  
  2. return $quote;

下面是修改之后的代码:

  1.  
  2. $quote = str_replace(‘{floor}’,’<span class="floor">’,$quote);
  3. $quote = str_replace(‘{/floor}’,’</span>’,$quote);
  4. return $quote;

3、修改/templets/default/style/page.css文件的第1169行
下面是修改之前的代码:

  1.  
  2. .decmt-content .decmt-box,.dede_comment .decmt-box .decmt-box {
  3.     background:#FFE;
  4.     border:1px solid #CCC;
  5.     margin:6px auto;
  6. }

下面是修改之后的代码:

  1.  
  2. /* .decmt-content .decmt-box,.dede_comment */.decmt-box .decmt-box {
  3.     background:#FFE;
  4.     border:1px solid #CCC;
  5.     margin:6px auto;
  6. }
  7. .floor{
  8.     float:right;
  9.     padding-right:10px;
  10. }
  11. .decmt-title{
  12.     margin-bottom:5px;
  13. }

4、PHP技术有限,有更好的实现方法请指正,经以上修改失败请回帖,修改成功后记得顶个贴^_^

本文让DEDE评论盖楼像腾讯 网易一样显示的如何实现方法到此结束。每当我看天的时候我就不喜欢再说话每当我说话的时候我却不敢再看天。小编再次感谢大家对我们的支持!

您可能有感兴趣的文章
织梦后台文档列表添加复制文档功能支持所有模型

织梦无法上传ico图标格式文件的如何解决方法

dedecms如何实现任意页面调用当前会员信息的方

织梦dede:tag调用指定多个栏目的TAG标签

织梦栏目列表按附加表自定义字段排序