Different ueditor configurations for different pages of zhimeng dedecms

Source: Internet
Author: User
Tags bbcode

Yesterday, I introduced the method of using Baidu ueditor to use different editor widths for different pages under dedecms. Although this method is practical, its limitations are also strong: only the width can be set. Other personalized configurations are not allowed. Next we will introduce you to a method for configuring the page personality of ueditor, that is, using different configurations for different pages. I think this method can solve many problems of webmasters and friends, as for which method you prefer, you will be right.

Different configurations are used when xiaochuang.com uses Baidu ueditor:

  

Configure the front-end editor to cancel the attachment upload and online image management functions.

  

Full-featured configuration of background Editor

Let's talk about how to implement it (for how to install ueditor, please go to the official forum ):

1. Copy/include/ueditor/editor_config.js, paste it, and rename it to/include/ueditor/editor_config1.js.

2. Add the following code in/include/helpers/util. helper. php (same as in the previous article ):

If (! Function_exists ('geteditord '))

{

Function GetEditorD ($ fname, $ fvalue, $ nheight = "350", $ etype = "Basic", $ gtype = "print", $ isfullpage = "FALSE ", $ bbcode = false)

{

If (! Function_exists ('spgeteditord '))

{

Require_once (DEDEINC. "/inc/inc_fun_funAdmin.php ");

}

Return SpGetEditorD ($ fname, $ fvalue, $ nheight, $ etype, $ gtype, $ isfullpage, $ bbcode );

}

}

3. Add the following code to/include/inc/inc_fun_funAdmin.php (a small change is made here ):

Function SpGetEditorD ($ fname, $ fvalue, $ nheight = "350", $ etype = "Basic", $ gtype = "print", $ isfullpage = "false ", $ bbcode = false)

{
Global $ cmd_ckeditor_initialized;
If (! Isset ($ GLOBALS ['cfg _ html_editor '])
{
$ GLOBALS ['cfg _ html_editor '] = 'fck ';
}
If ($ gtype = "")
{
$ Gtype = "print ";
}
If ($ GLOBALS ['cfg _ html_editor '] = 'fck ')
{
Require_once (DEDEINC. '/FCKeditor/fckeditor. php ');
$ Fck = new FCKeditor ($ fname );
$ Fck-> BasePath = $ GLOBALS ['cfg _ cmspath '].'/include/FCKeditor /';
$ Fck-> Width = '000000 ';
$ Fck-> Height = $ nheight;
$ Fck-> ToolbarSet = $ etype;
$ Fck-> Config ['fullpage'] = $ isfullpage;
If ($ GLOBALS ['cfg _ fck_xhtml '] = 'y ')
{
$ Fck-> Config ['enablexhtml '] = 'true ';
$ Fck-> Config ['enablesourcexhtml '] = 'true ';
}
$ Fck-> Value = $ fvalue;
If ($ gtype = "print ")
{
$ Fck-> Create ();
}
Else
{
Return $ fck-> CreateHtml ();
}
}
Else if ($ GLOBALS ['cfg _ html_editor '] = 'ckeditor ')
{
Require_once (DEDEINC. '/ckeditor. php ');
$ CKEditor = new CKEditor ();
$ CKEditor-> basePath = $ GLOBALS ['cfg _ cmspath '].'/include/ckeditor /';
$ Config = $ events = array ();
$ Config ['fig] = 'dedepage, multipic, addon ';
If ($ bbcode)
{
$ CKEditor-> initialized = true;
$ Config ['fig]. = ', bbcode ';
$ Config ['fontsize _ sizes '] = '1970%; 30/30%; 50/50%; 100/100%; 120/120%; 150/150%; 200/200% ';
$ Config ['disableobjectresizing '] = 'true ';
$ Config ['smiley _ path'] = $ GLOBALS ['cfg _ cmspath']. '/images/smiley /';
// Obtain emoticons
Require_once (DEDEDATA. '/smiley. data. php ');
$ Jsscript = array ();
Foreach ($ GLOBALS ['cfg _ smileys '] as $ key => $ val)
{
$ Config ['smiley _ images'] [] = $ val [0];
$ Config ['smiley _ description'] [] = $ val [3];
$ Jsscript [] = '"'. $ val [3]. '": "'. $ key .'"';
}
$ Jsscript = implode (',', $ jsscript );
Echo jsscript ('ckeditor. config. ubb_smiley = {'. $ jsscript .'}');
}
$ GLOBALS ['tool'] = empty ($ toolbar [$ etype])? $ GLOBALS ['tool']: $ toolbar [$ etype];
$ Config ['toolbar'] = $ GLOBALS ['tool'];
$ Config ['height'] = $ nheight;
$ Config ['skin'] = 'kama ';
$ CKEditor-> returnOutput = TRUE;
$ Code = $ CKEditor-> editor ($ fname, $ fvalue, $ config, $ events );
If ($ gtype = "print ")
{
Echo $ code;
}
Else
{
Return $ code;
}
} Else if ($ GLOBALS ['cfg _ html_editor '] = 'ueditor ')
{
$ Fvalue = ''? '<P> </p>': $ fvalue;
$ Code = '<script type = "text/javascript" charset = "gbk" src = "'. $ GLOBALS ['cfg _ cmspath']. '/include/ueditor/editor_config1.js "> </script> // The foreground configuration file
<Script type = "text/javascript" charset = "gbk" src = "'. $ GLOBALS ['cfg _ cmspath']. '/include/ueditor/editor_all_min.js "> </script>
<Link rel = "stylesheet" type = "text/css" href = "'. $ GLOBALS ['cfg _ cmspath']. '/include/ueditor/themes/default/ueditor.css "/>
<Textarea name = "'. $ fname. '"id = "'. $ fname. '"style =" width: 100%; "> '. $ fvalue. '</textarea>
<Script type = "text/javascript">
Var ue = new baidu. editor. ui. Editor (); ue. render ("'. $ fname.'"); // The width is not modified here
</Script> ';
If ($ gtype = "print ")
{
Echo $ code;
}
Else
{
Return $ code;
}
}
Else {
/*
//------------------------------------------------------------------------
// Currently, dedehtml editor is temporarily removed.
//------------------------------------------------------------------------
Require_once (DEDEINC. '/htmledit/dede_editor.php ');
$ Ded = new DedeEditor ($ fname );
$ Ded-> BasePath = $ GLOBALS ['cfg _ cmspath '].'/include/htmledit /';
$ Ded-> Width = '000000 ';
$ Ded-> Height = $ nheight;
$ Ded-> ToolbarSet = strtolower ($ etype );
$ Ded-> Value = $ fvalue;
If ($ gtype = "print ")
{
$ Ded-> Create ();
}
Else
{
Return $ ded-> CreateHtml ();
}
*/
}
}
3. On the editor page, run the following code:
<? Php GetEditor ("body", "", 350, "Member");?>
Changed:
<? Php GetEditorD ("body", "", 350, "Member");?>
4. When you need to display/hide the width of the front-end editor and some controls, you can directly modify/include/ueditor/editor_config1.js, such:
To cancel online image management, you only need
, ImageManagerUrl: URL + "php/imageManager. php"
And
, ImageManagerPath :"/"
The two lines can be commented out. For example, Xiao creative Network (www.smallcy.com) has added the function of deleting images and attachments in articles at the same time. If the online image management function is enabled on the front end, when an incorrect article uses images in online management, when we delete the article, the images in online management will be deleted at the same time, which will affect other articles, therefore, it is necessary to disable some functions on the front end.
To modify the editor width, you only need to modify:
, InitialFrameWidth: 1000
Change 1000 to the Desired width;
To hide some widgets, you only need to find the toolbars and then delete the flag of the corresponding widget.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.