Smarty中調(diào)用FCKeditor的方法
本文實(shí)例講述了Smarty中調(diào)用FCKeditor的方法,分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
FCKeditor是目前互聯(lián)網(wǎng)上最好的在線編輯器。
smarty是一個(gè)使用PHP寫出來的模板PHP模板引擎,它提供了邏輯與外在內(nèi)容的分離,簡(jiǎn)單的講,目的就是要使用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)文章
PHP 面向?qū)ο蟪绦蛟O(shè)計(jì)(oop)學(xué)習(xí)筆記 (五) - PHP 命名空間
PHP 在 5.3.0 以后的版本開始支持命名空間。什么是命名空間?從廣義上來說,命名空間是一種封裝事物的方法。在很多地方都可以見到這種抽象概念。2014-06-06使用VS?Code+phpstudy實(shí)現(xiàn)PHP環(huán)境配置指南
這篇文章主要給大家介紹了關(guān)于使用VS?Code+phpstudy實(shí)現(xiàn)PHP環(huán)境配置的相關(guān)資料,對(duì)于初學(xué)者可以使用集成開發(fā)環(huán)境PHPStudy來配置PHP環(huán)境,需要的朋友可以參考下2023-07-07PHP OPP機(jī)制和模式簡(jiǎn)介(抽象類、接口和契約式編程)
本文將介紹抽象類、接口和一種稱為契約式編程的技術(shù)。使用這些OPP機(jī)制,所編寫的代碼就不限于只能計(jì)算或者輸出內(nèi)容了。這些機(jī)制能夠在概念層次上定義類之間交互作用的規(guī)則,也為應(yīng)用程序的擴(kuò)展和定制提供了基礎(chǔ)。2014-06-06thinkPHP批量刪除的實(shí)現(xiàn)方法分析
這篇文章主要介紹了thinkPHP批量刪除的實(shí)現(xiàn)方法,結(jié)合實(shí)例形式分析了thinkPHP實(shí)現(xiàn)批量刪除數(shù)據(jù)的數(shù)據(jù)庫及模板操作相關(guān)技巧,需要的朋友可以參考下2016-11-11Laravel框架Eloquent ORM簡(jiǎn)介、模型建立及查詢數(shù)據(jù)操作詳解
這篇文章主要介紹了Laravel框架Eloquent ORM簡(jiǎn)介、模型建立及查詢數(shù)據(jù)操作,結(jié)合實(shí)例形式詳細(xì)分析了laravel框架Eloquent ORM基本概念、原理、模型建立及數(shù)據(jù)查詢等相關(guān)使用技巧,需要的朋友可以參考下2019-12-12對(duì)laravel的session獲取與存取方法詳解
今天小編就為大家分享一篇對(duì)laravel的session獲取與存取方法詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-10-10