DEDECMS会员评论时添加多个表情

时间:2014-09-12

大家知道我们使用的织梦模板默认的评论页,会员在添加评论的时候只可以选择一个表情。给我的感觉实在是不灵活,有些人发布评论的时候,可能需要表情和文字都结合,这样发出来的东西才有声有色的嘛。能不能修改下,实现多个表情呢?经过一番研究,还真的实现呢!

大家只需要两步就可以了。

第一步修改  feedback_ajax.php   文件。该文件在 根目录下的 plus / 文件夹下。打开该文件以后,查找以下代码:

if($dopost=='getlist')

在该代码的上面插入以下代码:

function convertem($message){
$a = array('[em01]','[em02]','[em03]','[em04]','[em05]','[em06]','[em07]','[em08]','[em09]','[em10]','[em11]','[em12]','[em13]','[em14]','[em15]','[em16]','[em17]','[em18]','[em19]','[em20]','[em21]','[em22]','[em23]','[em24]');
$b = array('<img src="../../../images/mood/ico-mood-1.gif" />','<img src="../../../images/mood/ico-mood-2.gif" />','<img src="../../../images/mood/ico-mood-3.gif" />','<img src="../../../images/mood/ico-mood-4.gif" />','<img src="../../../images/mood/ico-mood-5.gif" />','<img src="../../../images/mood/ico-mood-6.gif" />','<img src="../../../images/mood/ico-mood-7.gif" />','<img src="../../../images/mood/ico-mood-8.gif" />','<img src="../../../images/mood/ico-mood-9.gif" />','<img src="../../../images/mood/ico-mood-10.gif" />','<img src="../../../images/mood/ico-mood-11.gif" />','<img src="../../../images/mood/ico-mood-12.gif" />','<img src="../../../images/mood/ico-mood-13.gif" />','<img src="../../../images/mood/ico-mood-14.gif" />','<img src="../../../images/mood/ico-mood-15.gif" />','<img src="../../../images/mood/ico-mood-16.gif" />','<img src="../../../images/mood/ico-mood-17.gif" />','<img src="../../../images/mood/ico-mood-18.gif" />','<img src="../../../images/mood/ico-mood-19.gif" />','<img src="../../../images/mood/ico-mood-20.gif" />','<img src="../../../images/mood/ico-mood-21.gif" />','<img src="../../../images/mood/ico-mood-22.gif" />','<img src="../../../images/mood/ico-mood-23.gif" />','<img src="../../../images/mood/ico-mood-24.gif" />');
$message = str_replace($a,$b,$message);
return $message;
}

相关文章