dedecms 评论盖楼实现楼层数,类似腾讯、网易的评论(5.5/5.6版)

来源:Asp之家 时间:2010-12-08 16:12:00 

  DEDE评论效果:

 

 修改后的效果:

 

  修改步骤

  一、5.5版本(5.6版本请往下看)

  1、修改/plus/feedback_ajax.php文件的第131行(如果你没改过)

  下面是修改之前的代码:

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

  下面是修改后的代码:


//$qmsg = '{quote}{title}'.$row['username'].' 的原帖:{/title}{content}'.$row['msg'].'{/content}{/quote}';
$floors = substr_count($row['msg'], '{title}');//查找评论中楼层数
if ($floors > 0) {
$floors += 1;
$floor_html = '{floor}' . $floors . '{/floor}';
}
else {
$floor_html = '{floor}1{/floor}';
}
$quotetitle = '{title}引用' . $row['username'] . '的评论'. $floor_html .'{/title}';
$oldquote = '';//以前的引用
$quotemsg = $row['msg'];
if ($floors > 0) {
$oldquoteend = strrpos($quotemsg, '{/quote}') + 8;
$oldquote = substr($quotemsg, 0, $oldquoteend);
$quotemsg = substr($quotemsg, $oldquoteend);
}
$qmsg = '{quote}' . $oldquote . $quotetitle . '{content}' . $quotemsg . '{/content}{/quote}';

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

  下面是修改之前的代码:

  return $quote;

  下面是修改之后的代码:


$quote = str_replace('{floor}','<span class="floor">',$quote);
$quote = str_replace('{/floor}','</span>',$quote);
return $quote;

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

  
.floor {
float:right;
padding-right:10px;
}

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

  二、5.6版本

  1、修改/templets/plus/feedback_quote.htm文件的第94行(如果你没改过)

  下面是修改之前的代码:


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

 下面是修改之前的代码:


<input type="hidden" name="quotemsg" value="<?php
//echo '{quote}{title}'.$row['username'].' 的原帖:{/title}{content}'.$row['msg'].'{/content}{/quote}';
floors = substr_count($row['msg'], '{title}');//计算评论中楼层数
if ($floors > 0) {
$floors += 1;
$floor_html = '{floor}' . $floors . '{/floor}';
}
else {
$floor_html = '{floor}1{/floor}';
}
$quotetitle = '{title}' . $row['username'] . '的原帖'. $floor_html .'{/title}';
$oldquote = '';//以前的引用
$quotemsg = $row['msg'];
if ($floors > 0) {
$oldquoteend = strrpos($quotemsg, '{/quote}') + 8;
$oldquote = substr($quotemsg, 0, $oldquoteend);
$quotemsg = substr($quotemsg, $oldquoteend);
}
echo '{quote}' . $oldquote . $quotetitle . '{content}' . $quotemsg . '{/content}{/quote}';
?>" />

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

  下面是修改之前的代码:

  return $quote;

  下面是修改之后的代码:


$quote = str_replace('{floor}','<span class="floor">',$quote);
$quote = str_replace('{/floor}','</span>',$quote);
return $quote;

  3、修改/templets/default/style/page.css文件的第1169行

  下面是修改之前的代码:


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

     下面是修改之前的代码:


/* .decmt-content .decmt-box,.dede_comment */.decmt-box .decmt-box {
background:#FFE;
border:1px solid #CCC;
margin:6px auto;
}
.floor{
float:right;
padding-right:10px;
}
.decmt-title{
margin-bottom:5px;
}

标签:dedecms,评论
0
投稿

猜你喜欢

  • Discuz!论坛Tools工具箱功能详解

    2009-02-15 09:49:00
  • 谷歌新版Chrome Beta 添加新隐私保护功能

    2010-03-04 08:23:00
  • WordPress 插件——AlexaRank

    2009-02-12 12:24:00
  • 系统截图 Android 2.1对比Android 2.2

    2010-05-27 10:35:00
  • Godaddy主机如何购买额外的SMTP Relays

    2010-05-04 13:00:00
  • 交互性与口碑传播 看博客的广告两大策略

    2009-01-20 10:37:00
  • URL搜索引擎优化 绝对路径和相对路径释疑

    2009-02-01 11:09:00
  • 中国程序员需要改革开放

    2008-01-18 13:09:00
  • Windows 2000中任务时间表的帐号问题

    2007-10-18 14:35:00
  • Discuz! X2子目录伪静态的实现方法

    2011-09-21 12:47:37
  • 巨人CEO史玉柱母校招聘 看好浙江高潜质人才

    2009-12-03 11:29:00
  • 关于网站关键词与页面关键词的个人看法

    2008-12-30 13:15:00
  • 微软完成Win7“XP虚拟模式”软件开发工作

    2009-10-02 12:47:00
  • 分享WordPress博客搜索引擎优化十一点经验

    2010-03-25 16:54:00
  • 2010年SNS网站将成为网页游戏的春天

    2010-03-03 15:40:00
  • Godaddy主机修改主域名图文教程

    2011-07-26 18:38:55
  • 苹果市值超越Google 目标瞄准微软宝座

    2009-10-14 10:59:00
  • 微博发展面临桎梏 与手机结合或是未来的方向

    2010-03-08 10:45:00
  • win2003服务器安全设置教程

    2008-01-29 10:07:00
  • 草根站长软文写作技巧教程:让软文更软些吧

    2007-08-14 17:06:00
  • asp之家 网站运营 m.aspxhome.com