search
HomeCMS TutorialDEDECMSHow does dedecms realize the number of floors

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.