FCKeditor un son halini buradan indirin : http://ckeditor.com/download
proje içerisinde public/scripts/library/fckeditor içerisine dosyaları atın.
Controller içerisinde inite aşağıdaki atamayı yapın
public function init() {
$this->view->assign('fckeditorPath','http://'.getenv ( 'HTTP_HOST' ) . APPLICATION_ROOT.'/scripts/library/fckeditor/');
}
view de ise şu şekilde kullanıma hazır ;
window.onload = function()
{
if(document.getElementById('description')) {
var oFCKeditor = new FCKeditor('description') ;
oFCKeditor.BasePath = "fckeditorPath?>" ;
oFCKeditor.Height = 450;
oFCKeditor.Width = 700;
oFCKeditor.ReplaceTextarea() ;
}
}
config.php dosyasına ( public\scripts\library\fckeditor\editor\filemanager\connectors\php\config.php )
Aşağıdaki satırları ekleyin.
require_once 'Zend/Auth.php';
$isAuth = Zend_Auth::getInstance ()->hasIdentity ();
if( !isset($isAuth) || $isAuth == false ) {
return false;
}
Böylece sisteme login olan kişi sadece dosya yükleyebilecek. Yoksa fck nin yolunu bilen herkes bu işlemi yapabilirdi.
Ayrıca şu kodlarda yolları ayarlamada işinizi görecektir.
defined ( 'APPLICATION_ROOT' )
|| define ( 'APPLICATION_ROOT', substr ( $_SERVER ['PHP_SELF'], 0, strpos ( $_SERVER ['PHP_SELF'], '/scripts/library/fckeditor/editor/filemanager/connectors/php/connector.php' ) ) );
// Path to user files relative to the document root.
$Config['UserFilesPath'] = APPLICATION_ROOT. '/uploads/' ;
// 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.
$Config['UserFilesAbsolutePath'] = $_SERVER ['DOCUMENT_ROOT'] .'/'. APPLICATION_ROOT. '/uploads/';
Not: Yukardaki kodların tam düzgün çalışması için sessionun kaydediliği yerin varsayılan yer olması gerekiyor. Bu durumda
Zend_Session::start ( array ('save_path' => APPLICATION_PATH . '/../tmp/session' ) );
Gibi bir kod çalıştırırsanız aynısını fckeditor deki configdede yapmalısınız.
Varsayılan ;
Zend_Session::start();
Hiç yorum yok:
Yorum Gönder