Home > Article > CMS Tutorial > How does dedecms realize the number of floors
dedecmsHow to realize the number of floors?
DEDE comment effect:
Recommended: "dedecms tutorial"
$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; codeThe following is the code before modification:
return $quote;The following is the modified code: The code is as follows:
$quote = str_replace('{floor}','<span class="floor">',$quote); $quote = str_replace('{/floor}','</span>',$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.61. 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 '{title}'.$row['username'].' 的原帖:{/title}{content}'.$row['msg'].'{/content}'; ?>{/quote}" />The following is the modified code:The code is as follows:
<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. In/include/channelunit.func Line 519 of the .php file is to insert two lines of code before the return $quote; codeThe following is the code before modification:
return $quote;The following is the code after modification:The code is as follows:
$quote = str_replace('{floor}','<span class="floor">',$quote); $quote = str_replace('{/floor}','</span>',$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!