dedecmsHow to realize the number of floors?
DEDE comment effect:
Recommended: "dedecms tutorial"
$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}';
return $quote;
$quote = str_replace('{floor}','<span class="floor">',$quote); $quote = str_replace('{/floor}','</span>',$quote); return $quote;
.floor { float:right; padding-right:10px; }
<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}'; ?>" />
return $quote;
$quote = str_replace('{floor}','<span class="floor">',$quote); $quote = str_replace('{/floor}','</span>',$quote); return $quote;
.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; }
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!