php在頁面中調用fckeditor編輯器的方法
更新時間:2011年06月10日 00:19:47 作者:
fckeditor編輯器的代碼可以寫成一個函數(shù)或者類別,直接調用,不用每次都要寫那么多代碼!
剛才在論壇上看到一個童鞋分享的方法,感覺不是很全面,現(xiàn)在分享下我的!
PHP頁面:
/* 編輯器 */
include_once "../include/fckeditor/fckeditor.php";//把編輯器引進來
$editor = new FCKeditor('content');//表單項的名稱
$editor->BasePath = "/fckeditor/";//編輯器所在目錄
$editor->ToolbarSet = "Normal";//工具欄的名字,可以根據(jù)自己的需求加載其他的
$editor->Width = "95%";//寬度度
$editor->Height = "250";//高度
$editor->Value = $content;//初始值
$fckeditor = $editor->CreateHtml();//在要顯示編緝器的地方輸出變量$fckeditor的值就行了
$tpl->assign('fckeditor', $fckeditor);//模板賦值
HTML模板頁面(我用的是smarty)
{%$fckeditor%}
一般php頁面調用
content 是我定義的變量名
$content =$_POST["content"];
添加:
<INPUT name="content" id="content" type=hidden>
<IFRAME id="content" src="fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 ></IFRAME>
修改頁面:
<INPUT name="content" id="content" type=hidden value="<?php echo $rows['content'];?>">
<IFRAME id="content" src="/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 >
</IFRAME>
復制代碼 代碼如下:
PHP頁面:
/* 編輯器 */
include_once "../include/fckeditor/fckeditor.php";//把編輯器引進來
$editor = new FCKeditor('content');//表單項的名稱
$editor->BasePath = "/fckeditor/";//編輯器所在目錄
$editor->ToolbarSet = "Normal";//工具欄的名字,可以根據(jù)自己的需求加載其他的
$editor->Width = "95%";//寬度度
$editor->Height = "250";//高度
$editor->Value = $content;//初始值
$fckeditor = $editor->CreateHtml();//在要顯示編緝器的地方輸出變量$fckeditor的值就行了
$tpl->assign('fckeditor', $fckeditor);//模板賦值
HTML模板頁面(我用的是smarty)
{%$fckeditor%}
一般php頁面調用
content 是我定義的變量名
$content =$_POST["content"];
添加:
<INPUT name="content" id="content" type=hidden>
<IFRAME id="content" src="fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 ></IFRAME>
修改頁面:
<INPUT name="content" id="content" type=hidden value="<?php echo $rows['content'];?>">
<IFRAME id="content" src="/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 >
</IFRAME>
您可能感興趣的文章:
- FCKEditor超級鏈接默認新窗口打開的修改方法
- Smarty中調用FCKeditor的方法
- fckeditor編輯器下的自定義分頁符實現(xiàn)方法
- FCKeditor編輯器添加圖片上傳功能及圖片路徑問題解決方法
- ThinkPHP中FCKeditor編輯器的使用方法
- fckeditor編輯器在php中的配置方法
- Fckeditor編輯器內容長度限制統(tǒng)計實現(xiàn)方法
- FCKeditor 圖片上傳進度條不動的解決方法
- 瀏覽器執(zhí)行history.go(-1) FCKeditor編輯框內顯示html源代碼的解決方法
- FCK編輯器(FCKEditor)添加新按鈕和功能的修改方法
- fckeditor粘貼Word時彈出窗口取消的方法
相關文章
PHP基于Closure類創(chuàng)建匿名函數(shù)的方法詳解
這篇文章主要介紹了PHP基于Closure類創(chuàng)建匿名函數(shù)的方法,結合實例形式詳細分析了Closure 類的功能、常用函數(shù)使用技巧及相關注意事項,需要的朋友可以參考下2017-08-08