好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 網站建設 > 建站知識 > 為織夢dedecms不同頁面中百度ueditor編輯器設置不同

為織夢dedecms不同頁面中百度ueditor編輯器設置不同

POST TIME:2020-04-10 20:19

相信正在使用織夢dedecms作為網站管理程序的站長朋友對織夢自帶的ckeditor編輯器一定感到非常糾心:其難看的外觀,不太好用的添加視頻功能,超級弱智的圖片上傳項,就連按個"tab"鍵都要跳出編輯框...這些無不讓我們對其深惡痛絕(可能說得有點夸張)!

本人最近開了一個新站,最初因為這個ckeditor編輯器給編輯工作帶來了諸多不便,所以最后痛下決心:改成百度ueditor。

為什么改成ueditor而不是別的編輯器呢?原因主要有三點:

一、ueditor界面相當美觀,用起來舒服;

二、功能強悍,比如圖片上傳功能:它支持批量上傳,圖片搜索,還有非常不錯的圖片管理器;再比如視頻添加功能:直接填寫優酷土豆等視頻網址即可,不用像ckeditor那樣非常麻煩地去找".swf"的flash地址;

三、基于百度雄厚的實力,相信這個ueditor功能也會越來越強大。

是不是心動了?想體驗ueditor的朋友可以去我的小創意網(www.smallcy.com)看看,相信會帶給你不錯的體驗。

不過ueditor裝上后也不是馬上就能用的(至于怎么安裝,大家可以在官方論壇上找),一般都會存在一些小問題。下面我就來談談其中一個非常重要的問題的解決方案。

安裝完ueditor后,我們可以在ueditor的配置文件中對其界面寬度進行設置,但問題就出在這里,在這里設置的寬度是對全局而言,即所有網站內的編輯器寬度都一樣。但對于我們dedecms用戶而言,一般前臺和后臺編輯器寬度不一致,這樣就會造成編輯器越界的問題。解決方案:將ueditor寬度設置放在編輯器調用階段,具體做法如下:

1. /include/helpers/util.helper.php中增加以下代碼:

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);

}

}

2. /include/inc/inc_fun_funAdmin.php中增加以下代碼:

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

{

global $cfg_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 = '100%' ;

$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/ckeditor.php');

$CKEditor = new CKEditor();

$CKEditor->basePath = $GLOBALS['cfg_cmspath'].'/include/ckeditor/' ;

$config = $events = array();

$config['extraPlugins'] = 'dedepage,multipic,addon';

if($bbcode)

{

$CKEditor->initialized = true;

$config['extraPlugins'] .= ',bbcode';

$config['fontSize_sizes'] = '30/30%;50/50%;100/100%;120/120%;150/150%;200/200%;300/300%';

$config['disableObjectResizing'] = 'true';

$config['smiley_path'] = $GLOBALS['cfg_cmspath'].'/images/smiley/';

// 獲取表情信息

require_once(DEDEDATA.'/smiley.data.php');

$jsscript = array();

foreach($GLOBALS['cfg_smileys'] as $key=>$val)

{

$config['smiley_images'][] = $val[0];

$config['smiley_descriptions'][] = $val[3];

$jsscript[] = '"'.$val[3].'":"'.$key.'"';

}

$jsscript = implode(',', $jsscript);

echo jsscript('CKEDITOR.config.ubb_smiley = {'.$jsscript.'}');

}

 

$GLOBALS['tools'] = empty($toolbar[$etype])? $GLOBALS['tools'] : $toolbar[$etype] ;

$config['toolbar'] = $GLOBALS['tools'];

$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 = $fvalue=='' ? '<p></p>' : $fvalue;

$code = '<script type="text/javascript" charset="gbk" src="'.$GLOBALS['cfg_cmspath'].'/include/ueditor/editor_config.js"></script>

<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({ initialFrameWidth:824 });ue.render("'.$fname.'"); //紅色處為修改寬度

</script>';

if($gtype=="print")

{

echo $code;

}

else

{

return $code;

}

}

 

else {

/*

// ------------------------------------------------------------------------

// 當前版本,暫時取消dedehtml編輯器的支持

// ------------------------------------------------------------------------

require_once(DEDEINC.'/htmledit/dede_editor.php');

$ded = new DedeEditor($fname);

$ded->BasePath = $GLOBALS['cfg_cmspath'].'/include/htmledit/' ;

$ded->Width = '100%' ;

$ded->Height = $nheight ;

$ded->ToolbarSet = strtolower($etype);

$ded->Value = $fvalue ;

if($gtype=="print")

{

$ded->Create();

}

else

{

return $ded->CreateHtml();

}

*/

}

}

3. 在編輯器調取頁面將以下代碼:

<?php GetEditor("body","",350,"Member"); ?>

改為:

<?phpGetEditorD("body","",350,"Member"); ?>

以上方案的思想是:在不同界面使用不同的編輯器調用函數。

當然你可以根據需要對以上代碼進行刪改,還有什么問題可以去小創意網(www.smallcy.com)咨詢。



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266