站点介绍
今天来分享下zblog用户模板中增加字段并且使用UEditor编辑器输入的方法。
这个方法以前很少用,一般的地方也确实不太需要这种自定义字段输入方法,给用户增加一个,有编辑器的自定义字段!
1、首先挂:
Add_Filter_Plugin('Filter_Plugin_Member_Edit_Response','laoyublogcom_Member_Edit');//用户自定义字段2、include.php中加入:
function laoyublogcom_Member_Edit(){global $zbp,$member; echo "<script type=\"text/javascript\" src=\"{$zbp->host}zb_users/plugin/UEditor/ueditor.config.php\"></script>"; echo "<script type=\"text/javascript\" src=\"{$zbp->host}zb_users/plugin/UEditor/ueditor.all.min.js\"></script>"; echo "<script type=\"text/javascript\" src=\"{$zbp->host}zb_users/theme/{$zbp->theme}/settings/UEditor.js\"></script>"; echo ' <textarea type="text" id="myEditor" name="meta_subtitle" placeholder="产品说明" rows="6">'.$member->Metas->subtitle.'</textarea>';}其中,UEditor.js为:
var editor = new baidu.editor.ui.Editor({ toolbars:[[ 'source',//html 'Paragraph',//段落 //'RowSpacing',//未知 'FontFamily',//字体 'FontSize',//字号px 'Bold',//粗体 'Italic',//斜体 'underline',//下划线 'strikethrough',//删除线 'ForeColor',//颜色 'backcolor',//背景颜色 'link',//超链接 'insertimage',//上传图片 'attachment',//附件 'insertvideo',//视频 'blockquote',//引用 'insertunorderedlist',//无序列表 'insertorderedlist',//有序列表 'inserttable',//插入表格 'justifyleft',//居左 'justifycenter',//居中 'justifyright',//居右 'indent',//缩进 'removeformat',//清除格式 'formatmatch',//格式刷 'autotypeset',//自动排版 'lineheight',//行间距 ]] });editor.render("myEditor");3、前端模板调用:
{$author.Metas.subtitle}