《PHP編程:Smarty中調用FCKeditor的方法》要點:
本文介紹了PHP編程:Smarty中調用FCKeditor的方法,希望對您有用。如果有疑問,可以聯系我們。
本文實例講述了Smarty中調用FCKeditor的辦法,分享給大家供大家參考.具體實現辦法如下:PHP編程
FCKeditor是目前互聯網上最好的在線編輯器.PHP編程
smarty是一個使用PHP寫出來的模板PHP模板引擎,它提供了邏輯與外在內容的分離,簡單的講,目的就是要使用PHP程序員同美工分離,使用的程序 員改變程序的邏輯內容不會影響到美工的頁面設計,美工重新修改頁面不會影響到程序的程序邏輯,這在多人合作的項目中顯的尤為重要.PHP編程
在Smarty中調用FCKeditor的文件:PHP編程
代碼如下:
require_once("conn.php");?
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');
但是運用這一種辦法在編輯資料的時候竟然FCKeditor傳不了值,只是生成了一個空值的編輯器,所以只能換一種辦法:PHP編程
代碼如下:
require_once("conn.php");?
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:PHP編程
代碼如下:
<htm>?
<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>
希望本文所述對大家的PHP程序設計有所贊助.PHP編程
維易PHP培訓學院每天發布《PHP編程:Smarty中調用FCKeditor的方法》等實戰技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養人才。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/14409.html