1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > zblogPHP分类模板添加自定义字段(调用UEditor编辑器输入法) – zblog模板学习 –

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

时间:2019-08-04 11:29:02

相关推荐

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

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

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

1、首先挂:

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

2、include.php中加入:

functionyunduanmp_cate_subtitle(){global$zbp,$cate;echo"<scripttype=\"text/javascript\"src=\"{$zbp->host}zb_users/plugin/UEditor/ueditor.config.php\"></script>";echo"<scripttype=\"text/javascript\"src=\"{$zbp->host}zb_users/plugin/UEditor/ueditor.all.min.js\"></script>";echo"<scripttype=\"text/javascript\"src=\"{$zbp->host}zb_users/theme/{$zbp->theme}/admin/js/UEditor.js\"></script>";echo<textareatype="text"id="myEditor"name="meta_subtitle"placeholder="产品说明"rows="6">.$cate->Metas->subtitle.</textarea>;}

其中,UEditor.js为:

参数可以查看教程:/website/document.html

vareditor=newbaidu.editor.ui.Editor({toolbars:[[source,//htmlParagraph,//段落//RowSpacing,//未知FontFamily,//字体FontSize,//字号pxBold,//粗体Italic,//斜体underline,//下划线strikethrough,//删除线ForeColor,//颜色ackcolor,//背景颜色link,//超链接insertimage,//上传图片attachment,//附件insertvideo,//视频lockquote,//引用insertunorderedlist,//无序列表insertorderedlist,//有序列表inserttable,//插入表格justifyleft,//居左justifycenter,//居中justifyright,//居右indent,//缩进 emoveformat,//清除格式formatmatch,//格式刷autotypeset,//自动排版lineheight,//行间距]]});editor.render("myEditor");

3、前端模板调用:

{$category->Metas->subtitle}

zblogPHP分类模板添加自定义字段(调用UEditor编辑器输入法) – zblog模板学习 – 前端 thinkphp 引入图片路径问题

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。