zblogPHP分类模板添加自定义字段(调用UEditor编辑器输入法)

8976988821周前 (01-08)zblog2

今天来分享下zblogPHP分类模板中增加字段并且使用UEditor编辑器输入的方法。

这个方法以前很少用,一般的地方也确实不太需要这种自定义字段输入方法,但今天重写了yunduanmp模板,其中每个分类列表页面,都有一个对分类的简介,为了更好的效果,使用带有编辑器的自定义字段输入最佳!

自定义字段编辑器调用方法:

1、首先挂:

Add_Filter_Plugin('Filter_Plugin_Category_Edit_Response','yunduanmp_cate_subtitle');//分类自定义字段

2、include.php中加入:

function yunduanmp_cate_subtitle(){ global $zbp,$cate; 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}/admin/js/UEditor.js\"></script>"; echo ' <textarea type="text" id="myEditor" name="meta_subtitle" placeholder="产品说明" rows="6">'.$cate->Metas->subtitle.'</textarea>';}

其中,UEditor.js为:

参数可以查看教程:http://ueditor.baidu.com/website/document.html

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、前端模板调用:

{$category->Metas->subtitle}



扫描二维码推送至手机访问。

版权声明:本文由米表程序发布,如需转载请注明出处。

本文链接:https://www.9909999.xyz/post/167.html

分享给朋友: