Hi Eric
Thank you for your answer, but unfortunatly it doesn't solve my problem.
When i create a normal php file with your code and change the path's to the one i specified in
my Zend_Form_Element it's working as it should be, and the strange thing is if i then reload the page
with my Zend_Form_Element for Cute Editor it's also working great.
So it seems that my Zend_Form_Element that i'm writing to use Cute Editor with
Zend Framework doesn't set the Gallery's and template paths to the include_CuteEditor.php file or the cache.
Below you can see my Zend_Form_Element source code for using Cute Editor with the Zend Framework (i used the Joomla plugin as example)
- <?php
-
- require_once 'Zend/Registry.php';
- require_once 'ZendX/JQuery/View/Helper/UiWidget.php';
-
- class app_View_Helper_FormCuteEditor extends Zend_View_Helper_FormTextarea
- {
- public function setView(Zend_View_Interface $view)
- {
- parent::setView($view);
- $this->CuteEditor = $this->view->CuteEditor();
- $this->CuteEditor->enable();
- return $this;
- }
-
- function onGetContent($name, $editor)
- {
- return "document.getElementById(".$this->view->escape($name).").getHTML();";
- }
-
- function onSetContent($name, $editor, $html)
- {
- return "document.getElementById(".$this->view->escape($name).").setHTML(".$html.");";
- }
-
- function onSave($name, $editor)
- {
- return "document.getElementById(".$this->view->escape($name).").value=document.getElementById(".$this->view->escape($name).").getHTML();";
- }
-
- public function formCuteEditor($name, $value = null, $attribs = null, $options = null)
- {
- $info = $this->_getInfo($name, $value, $attribs);
- extract($info);
-
- $disabled ='';
- if($disabled){
-
- $disabled = ' disabled = "disabled"';
- }
-
-
-
- if(is_numeric($attribs['rows'])){
- $rows = $attribs['rows'];
- }
- if(is_numeric($attribs['cols'])){
- $cols = $attribs['cols'];
- }
-
- $value = str_replace("<", "<", $value);
- $value = str_replace(">", ">", $value);
- $value = str_replace("&", "&", $value);
- $value = str_replace(" ", " ", $value);
- $value = str_replace(array(""","'"), array("\"", "'"), $value);
-
-
-
-
-
-
- require_once 'scripts/editors/CuteEditor/include_CuteEditor.php';
-
- $editor = new CuteEditor();
- $editor->ID = $this->view->escape($name);
- $editor->Width = $cols;
- $editor->Height = $rows;
- $editor->Text = $value;
-
-
- if ($editor->EditorWysiwygModeCss)
- {
-
- $db = Zend_Registry::get('dbconnection');
- $query = "SELECT template_name FROM site_templates";
- $template = $db->fetchAll($query);
-
- $file_path = $this->HTMLPath('templates/'. $template . '/css/');
-
- if (file_exists(ROOT_PATH . '/templates/' . $template . '/css/editor.css'))
- {
- $content_css = $file_path . 'editor.css';
- }else{
- $content_css = $file_path . 'template.css';
- }
- }
- $editor->EditorWysiwygModeCss = $content_css;
- $editor->ThemeType = 'Office2007';
-
- $ImageGalleryPath = '/Uploads/images';
- $FlashGalleryPath = '/Uploads/flash';
- $MediaGalleryPath = '/Uploads/media';
- $FilesGalleryPath = '/Uploads/files';
- $TemplateGalleryPath = '/Templates';
-
- $editor->ImageGalleryPath = $this->HTMLPath($ImageGalleryPath);
- $editor->FlashGalleryPath = $this->HTMLPath($FlashGalleryPath);
- $editor->MediaGalleryPath = $this->HTMLPath($MediaGalleryPath);
- $editor->FilesGalleryPath = $this->HTMLPath($FilesGalleryPath);
- $editor->TemplateGalleryPath = $this->HTMLPath($TemplateGalleryPath);
-
- $editor->Draw();
- }
-
- function HTMLPath($input_path)
- {
- if(substr($input_path, 0, 1)!="/")
- {
- $ThisFileName = basename($_SERVER['PHP_SELF']);
- $abspath = str_replace($ThisFileName,"",$_SERVER['PHP_SELF']);
- $input_path=$abspath.$input_path;
- $input_path = str_replace('/', '', $input_path );
- }
- return $input_path;
- }
- }