ThinkPHP下使用Ueditor

來源:互聯網
上載者:User

標籤:c   style   class   blog   code   java   

在做課程設計的時候想到用百度的Ueditor,可在配置的時候出現了一些問題

Ueditor感覺不是很難,以前有個人定製的,現在取消了這項服務,但是我們可以自己進行配置

:http://ueditor.baidu.com/website/download.html#ueditor

下載好檔案後,把檔案解壓,把檔案裡的所有檔案放到項目下的Public檔案下,

因為我們在很多地方都需要使用編輯器,所以放在Public下方便使用

在<head>……</head>下添加如下代碼

?
1 2 3 <script type="text/javascript" src="__PUBLIC__/Ueditor/ueditor.config.js"></script> <script type="text/javascript" src="__PUBLIC__/Ueditor/ueditor.all.js"></script> <link type="text/javascript" src="__PUBLIC__/Ueditor/themes/default/ueditor.css"></link>

  在<body>……</body>下添加如下代碼

<script type="text/javascript" charset="utf-8">        var editor = new baidu.editor.ui.Editor({initialFrameWidth:510});        editor.render(‘editor‘); //editor為<div>或<textarea>中定義的id 屬性 </script>

設定後編輯器並沒有顯示,還有重要一步配置editor_config.js,如何配置呢?

方法如下:
找到URL = window.UEDITOR_HOME_URL||tmp.substr(0,tmp.lastIndexOf("\/")+1).replace("_examples/","").replace("website/","");//這裡可以配置成ueditor目錄網站的相對路徑或者絕對路徑(指以http開頭的絕對路徑)

將url改成網站的相對路徑或絕對路徑(建議用絕對路徑)
比如:URL = "http://localhost:3306/Public/ueditor/";

 

對於現在不能定製的問題,我們可以再ueditor.config.js檔案中

找到 toolbars:   裡面的控制項進行增刪

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.