2008年10月11日 星期六

Zend framework + FCKeditor

http://uimama.com/park/thread-532-1-1.html

http://liuyami.com/archives/22.html

http://m955.com/wp/archives/76


RewriteCond %{REQUEST_URI} !^.*(\.html|\.xml|\.css|\.js|\.gif|\.png|\.jpg|\.jpeg)$|.*(fckeditor).*


class Zend_View_Helper_Fckeditor
{
function fckeditor($InstanceName='',$value='',$width=800,$height=500,$toolbar='Default',$skinPath='skins/default/')
{//var_dump(str_replace('\\', '/', dirname(__FILE__)));
require_once (str_replace('\\', '/', dirname(__FILE__)) ."/../../../../../htdocs/js/fckeditor/fckeditor.php");
$fc = Zend_Controller_Front::getInstance();

$iFCKeditor = new FCKeditor($InstanceName);
#網址路徑
$iFCKeditor->BasePath = $fc->getBaseUrl() ."/htdocs/js/fckeditor/";
$iFCKeditor->Width = $width;
$iFCKeditor->Height = $height;
$iFCKeditor->Value = $value;
#Default Basic
$iFCKeditor->ToolbarSet = $toolbar;
#$skinPath='skins/default/' , 'skins/silver/' , 'skins/office2003/'
$iFCKeditor->Config['SkinPath'] = $skinPath;

return $iFCKeditor->CreateHtml();
}
}


config.php
// Path to user files relative to the document root.
#$Config['UserFilesPath'] = '/userfiles/' ;
#網址
$Config['UserFilesPath'] = '/zf/htdocs/userfiles/' ;

// Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' must point to the same directory.
#t儲存真實路徑---若沒填時使用網址
$Config['UserFilesAbsolutePath'] = str_replace('\\', '/', dirname(__FILE__)) ."/../../../../../../userfiles/" ;

phtml
echo $this->fckeditor('content_text','test_text',560,500,'Basic','skins/office2003/');

沒有留言:

張貼留言