javascript - TinyMCE 或 CKeditor 与 Zend 的集成问题

标签 javascript jquery zend-framework tinymce ckeditor

文件夹结构如下所示:

Application
-- Layouts
---- layout.phtml (the 'template' file which loads all the .phtml files into, like insert.phtml form the pages folder, and loads init.js)
-- Modules
---- Admin
------ Views
-------- Scripts
---------- Pages
------------ insert.phtml (the actual file where I want to use tinyMCE)
Library
Public
-- Tinymce
---- tiny_mc.js
-- Jquery
---- init.js (loads the tiny_mce.js file using this code:

我使用 Loader 将其调用到文本区域,它看起来像这样:

$('.textEditor').Loader({
  url: ['../../../tinymce/tiny_mce.js'],
  debug: [true],
  cache: [true],
  success: function(target){
   tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    editor_selector : "textEditor",
    plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

    // Theme options
    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
   });
  }
 });

当我查看我的控制台时,我得到了这个:

Loading: ../../../tinymce/tiny_mce.js
Loaded: ../../../tinymce/tiny_mce.js (126ms)
/dgpcms/public/admin/pages/insert//langs/en.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/dgpcms/public/admin/pages/insert//plugins/style/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/dgpcms/public/admin/pages/insert//plugins/layer/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/dgpcms/public/admin/pages/insert//plugins/table/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/dgpcms/public/admin/pages/insert//themes/advanced/editor_template.jsFailed to load resource: the server responded with a status of 404 (Not Found)

....等等所有插件....

如何让 tinyMCE 忽略 Zend App 的 MVC 结构? 或者如何解决这个问题...

提前致谢

这是在我的公用文件夹中找到的 .htacces 文件的内容:

SetEnv APPLICATION_ENV开发

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|txt|swf)$ index.php

编辑:2010 年 3 月 11 日

在 .htaccess 文件中更改了一些内容,并将其更改回之前的设置(如上述情况),但错误已更改:

Loading: ../../../tinymce/tiny_mce.js
Loaded: ../../../tinymce/tiny_mce.js (230ms)
/langs/en.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/themes/advanced/editor_template.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/plugins/layer/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/plugins/table/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)
/plugins/save/editor_plugin.jsFailed to load resource: the server responded with a status of 404 (Not Found)

以此类推所有插件

所以它现在正在寻找之前的另一个文件夹。有人有什么想法吗?

编辑:2010 年 5 月 11 日

这真的让我很烦!我用CKeditor试了一下,还是出现同样的问题。我尝试将 .htaccess 文件放入文件夹中(对于 tinyMCE 和 CKeditor)并设置为“RewriteEngine Off”,但这没有任何区别。

编辑:22-11-2010

在我的布局文件中加载 tinyMCE 是可行的。这不是最好的解决方案,但总比没有好...

最佳答案

我想你把这个 JS 代码放在 View 上,但我会做一些修改

    <?php
          $this->headScript()->captureStart();
                        /* insert some javascript here */
    $('.textEditor').Loader({
      url: [$this->baseUrl("tinymce/tiny_mce.js")],
      //// don't forget to add the rest of your javascript code here 
     });
         $this->headScript()->captureEnd();
    echo $this->headScript();
    ?>

现在 $this->baseUrl() 将计算最佳链接,而不是手动对其进行硬编码以获取更多信息,请查看 http://framework.zend.com/manual/en/zend.view.helpers.html

关于javascript - TinyMCE 或 CKeditor 与 Zend 的集成问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4068135/

相关文章:

javascript - 将对象数组转换为对象

javascript - 内部 CSS 不会覆盖外部 CSS(api google)...为什么?

javascript - 文本作为文本框输入的占位符?

javascript - js 显示的元素在一段时间内无法访问

javascript - jquery父容器的宽度

zend-framework - 调用 _redirect 时 Firebug 中没有输出

mysql - Zend_Db_Table 中的 "IS NULL"选择不工作

javascript - 与非 DOM 元素相比,使用 createDocumentFragment 有什么好处吗?

javascript - 保留可用于聚焦后代的按键事件

zend-framework - Zend Framework - 从 Bootstrap 获取前端 Controller ?