Home  >  Article  >  CMS Tutorial  >  How does dedecms realize the number of floors

How does dedecms realize the number of floors

藏色散人
藏色散人Original
2019-11-19 11:34:331908browse

How does dedecms realize the number of floors

dedecmsHow to realize the number of floors?

DEDE comment effect:

Recommended: "dedecms tutorial"

How does dedecms realize the number of floors

##Modification The final effect:

How does dedecms realize the number of floors

Modification steps

1. Version 5.5 (please read below for version 5.6)

1. Modification/plus Line 131 of the /feedback_ajax.php file (if you have not changed it)

The following is the code before modification:

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

The following is the modified code:

The code is as follows :

//$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. In line 516 of the /include/channelunit.func.php file, insert two lines of code before the return $quote; code

The following is the code before modification:

return $quote;

The following is the modified code:

The code is as follows:

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

3. Add the following CSS code (anywhere) at the end of the /templets/style/dedecms.css file All are OK)

The code is as follows:

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

4. PHP technology is limited. If you have a better implementation method, please correct me. If the above modification fails, please reply. If the modification is successful, remember to like it^_ ^

2. Version 5.6

1. Modify line 94 of the /templets/plus/feedback_quote.htm file (if you have not changed it)

The following is before modification Code:

The code is as follows:

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

The following is the modified code:

The code is as follows:

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

2. In/include/channelunit.func Line 519 of the .php file is to insert two lines of code before the return $quote; code

The following is the code before modification:

return $quote;

The following is the code after modification:

The code is as follows:

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

3. Modify line 1169 of the /templets/default/style/page.css file

The following is the code before modification:

Code As follows:

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

The following is the modified code:

The code is as follows:

/* .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;
}

The above is the detailed content of How does dedecms realize the number of floors. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn