如何在php留言板中添加表情?

如何在php留言板中添加表情?,第1张

举个例子<input type="radio" name="face" value="gx"/>高兴(表情图片)

<input type="radio" name="face" value="fn"/>愤怒(表情图片)

<input type="radio" name="face" value="dx"/>大笑(表情图片)

<input type="radio" name="face" value="wl"/>高兴(表情图片)

把value存进数据库就行!

然后读取的时候<?php echo "<img src=\"$face\."\.gif"\">"?>

首先要在网上下载到FCKeditor解压包,解压后去掉不相关的文件,如ASP等,可以压缩文件大小。将FCKeditor目录放在网站根目录.

在配置文件fckconfig.js中,将

FCKConfig.ToolbarSets["Default"] = [

['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],

['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],

['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],

['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],

'/',

['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],

['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],

['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],

['Link','Unlink','Anchor'],

['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],

'/',

['Style','FontFormat','FontName','FontSize'],

['TextColor','BGColor'],

['FitWindow','ShowBlocks','-','About'] // No comma for the last row.

]

改为

FCKConfig.ToolbarSets["Default"] = ['Smiley']

只保留表情功能,然后建立调试页面test.php调用编辑器:

<?php

//包含fckeditor类

include("/fckeditor/fckeditor.php")

//创建一个FCKeditor,表单名称为 jzleditor

$oFCKeditor = new FCKeditor("jzleditor")

//设置编辑器路径

$oFCKeditor->BasePath = "/fckeditor/"

$oFCKeditor->ToolbarSet = "Default"//工具按钮

$oFCKeditor->Value =$cont //设置初始内容

$oFCKeditor->Width="100%" //设置它的宽度

$oFCKeditor->Height="550px" //设置它的高度

$oFCKeditor->Create()

?>

特定的标签带包特定的表情。在显示的时候替换一下就行了。

比如笑的标签 [笑],我在选择笑这张图片的时候会把[笑]插入到文本框,提交以后显示的时候先用php把[笑]替换成相应的图片。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11892040.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存