打開dedecms的后臺(tái)添加文檔的時(shí)候,發(fā)現(xiàn)竟然中國字體沒有?那么遇到這種情況我們應(yīng)該怎么辦呢?
其實(shí)辦法很簡單
DedeCMS 5.7集成了ckeditor網(wǎng)頁編輯器,它的原名是FCKeditor,是一個(gè)非常優(yōu)秀的開源網(wǎng)頁編輯器,但二者的配置卻不完全相同。
下面為ckeditor網(wǎng)頁編輯器添加中文字體的方法:
打開 include/ckeditor/ckeditor.js ,搜索 i.font_names ,找到字體列表。添加所需的中文字體,添加后為:
i.font_names= 'Arial/Arial, Helvetica, sans-serif;Comic Sans MS/Comic Sans MS,
cursive;Courier New/Courier New, Courier, monospace;Georgia/Georgia,
serif;Lucida Sans Unicode/Lucida Sans Unicode, Lucida Grande, sans-serif;Tahoma/Tahoma,
Geneva, sans-serif;Times New Roman/Times New Roman, Times, serif;Trebuchet MS/Trebuchet MS,
Helvetica, sans-serif;Verdana/Verdana, Geneva, sans-serif;
宋體/宋體;黑體/黑體;仿宋/仿宋_GB2312;楷體/楷體_GB2312;隸書/隸書;幼圓/幼圓;微軟雅黑/微軟雅黑' ;
需要特別注意的是:添加的字體,要寫成諸如“宋體/宋體”的形式,而不是“宋體”。即“顯示的字體名稱/實(shí)際字體名稱”的格式。
有的同學(xué)在添加完后發(fā)現(xiàn)后臺(tái)還是原來的樣子,沒有增加字體???奇怪怎么回事呢?
這里要注意了,你更新了js后后臺(tái)調(diào)用的js他還有緩沖沒有更新(題外話:最近很多同學(xué)在dedecms
模板下載安裝到網(wǎng)站后,也忘了更新緩存造成出錯(cuò)),這時(shí)候你要把
<!-- 添加下面的代碼 -->
<textarea name="body" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
window.CKEDITOR_BASEPATH='/include/ckeditor/';
//]]></script>
<script type="text/javascript" src="/include/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('body', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":450,"skin":"kama"});
//]]></script>
這段代碼放到首頁更新下首頁,然后再把這段代碼去掉,這時(shí)候你到后臺(tái)就可以看到你添加的字體了。