關(guān)于DedeCMS的使用教程,介紹了很多,相信各位站長都有所了解,今天我們來看一個美化評論樣式,實現(xiàn)仿騰訊、網(wǎng)易、迅雷等的蓋樓效果,這是筆者前段時間就美化了的,當初只是仿了騰訊的樣式,在蓋樓時遇到了麻煩,因為dedecms的蓋樓功能是按照引用一次設計的,如果引用多次就會出現(xiàn)引用在上面,而發(fā)言在下面的效果,演示見這里,效果見圖一
圖二
現(xiàn)在就把這篇教程轉(zhuǎn)來給大家,作者共提供了兩個版本的修改教程。
先看DEDECMS5.5的修改方法:
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}');//查找評論中樓層數(shù) 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; } |