Smarty中調(diào)用FCKeditor的方法
本文實(shí)例講述了Smarty中調(diào)用FCKeditor的方法,分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
FCKeditor是目前互聯(lián)網(wǎng)上最好的在線編輯器。
smarty是一個(gè)使用PHP寫出來的模板PHP模板引擎,它提供了邏輯與外在內(nèi)容的分離,簡單的講,目的就是要使用PHP程序員同美工分離,使用的程序 員改變程序的邏輯內(nèi)容不會(huì)影響到美工的頁面設(shè)計(jì),美工重新修改頁面不會(huì)影響到程序的程序邏輯,這在多人合作的項(xiàng)目中顯的尤為重要。
在Smarty中調(diào)用FCKeditor的文件:
require_once("class/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "../templates";
$smarty->compile_dir = "../templates_c";
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$editor = new FCKeditor("Content") ;
$editor->BasePath = "../FCKeditor/";
$editor->ToolbarSet = "Basic";
$editor->Value = "";
$FCKeditor = $editor->CreateHtml();
$smarty->assign('Title',"Rossy is here waiting for you");
$smarty->assign('FCKeditor',$FCKeditor);
$smarty->display('template.tpl');
但是運(yùn)用這一種方法在編輯資料的時(shí)候竟然FCKeditor傳不了值,只是生成了一個(gè)空值的編輯器,所以只能換一種方法:
require_once("class/Smarty.class.php");
$smarty = new Smarty();
$smarty->template_dir = "../templates";
$smarty->compile_dir = "../templates_c";
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$editor = new FCKeditor("Content") ;
$editor->BasePath = "../FCKeditor/";
$editor->ToolbarSet = "Basic";
$editor->Value = "Here is a example of smarty and FCKeditor";
$smarty->assign('Title',"Rossy is here waiting for you");
$smartyl->assign_by_ref("FCKeditor",$editor);
$smarty->display('template.tpl');
模板文件template.tpl:
<head>
<title>example of smarty use fckeditor</title>
</head>
<body>
<P>Example</p>
<p>title:<{$Title}></p>
<p></p>
<p>content:</p>
<p><{$FCKeditor}></p>
</body>
</html>
希望本文所述對(duì)大家的PHP程序設(shè)計(jì)有所幫助。
相關(guān)文章
destoon后臺(tái)網(wǎng)站設(shè)置變成空白的解決方法
這篇文章主要介紹了destoon后臺(tái)網(wǎng)站設(shè)置變成空白的解決方法,需要的朋友可以參考下2014-06-06
Laravel基礎(chǔ)_關(guān)于view共享數(shù)據(jù)的示例講解
今天小編就為大家分享一篇Laravel基礎(chǔ)_關(guān)于view共享數(shù)據(jù)的示例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-10-10
CodeIgniter刪除和設(shè)置Cookie的方法
這篇文章主要介紹了CodeIgniter刪除和設(shè)置Cookie的方法,涉及CodeIgniter操作cookie的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-04-04
Laravel框架實(shí)現(xiàn)model層的增刪改查(CURD)操作示例
這篇文章主要介紹了Laravel框架實(shí)現(xiàn)model層的增刪改查(CURD)操作,結(jié)合實(shí)例形式分析了Laravel框架模型model層進(jìn)行數(shù)據(jù)庫的增刪改查操作具體實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-05-05
關(guān)于php微信訂閱號(hào)開發(fā)之token驗(yàn)證后自動(dòng)發(fā)送消息給訂閱號(hào)但是沒有消息返回的問題
最近做了個(gè)項(xiàng)目,當(dāng)token驗(yàn)證之后,發(fā)送消息給訂閱號(hào),但是沒有消息返回,下面小編通過本篇文章給大家分享我的解決辦法2015-12-12

