温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

dedecms实现楼层数的方法

发布时间:2020-08-26 10:00:01 来源:亿速云 阅读:145 作者:小新 栏目:建站服务器

这篇文章将为大家详细讲解有关dedecms实现楼层数的方法,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

dedecms怎么实现楼层数?

DEDE评论效果:

dedecms实现楼层数的方法

修改后的效果:

dedecms实现楼层数的方法

修改步骤

一、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实现楼层数的方法就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI