TinyMCE 或 CKeditor 与 Zend 的集成问题

发布于 2024-09-30 10:27:10 字数 4319 浏览 0 评论 0原文

文件夹结构如下所示:

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

编辑:03-11-2010

更改了 .htacces 文件中的某些内容。 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 文件放入具有“RewriteEngine Off”的文件夹(适用于tinyMCE和CKeditor),但这没有任何区别。

编辑:2010年11月22日

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

The folder structure looks like this:

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:

I call this to a textarea using Loader, and that looks like this:

$('.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,
   });
  }
 });

When I look into my console I get this:

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)

.... and so on for all plugins ....

How can I get tinyMCE to ignore the MVC structure of the Zend App?
Or how to solve this problem...

Thanks in advance

This is the contents of my .htacces file as found in my public folder:

SetEnv APPLICATION_ENV development

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

Edit: 03-11-2010

Changed something in the .htaccess file, and changed it back how it was setup before (as in the above situation), but the error has changed:

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)

And so on for all plugins

So it's now looking in an other folder then before. Anybody any idea?

Edit: 05-11-2010

This is really bugging me out! I tried it with CKeditor, but the same problem occurs. I tried putting a .htaccess file in the folder (both for tinyMCE and CKeditor) with 'RewriteEngine Off', but that didn't make any difference.

Edit: 22-11-2010

Loading the tinyMCE on my layout file works. Not the best solution in this way, but it's better then nothing...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无悔心 2024-10-07 10:27:10

我想你把这个 JS 代码放在视图上,但我

    <?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

I suppose your putting this JS code on the view , but i would do some modification

    <?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();
    ?>

now $this->baseUrl() will calculate the best link instead of hard-coding it manually for more info check out http://framework.zend.com/manual/en/zend.view.helpers.html

风为裳 2024-10-07 10:27:10

你能不能只使用:

$('.textEditor').Loader({
    url: ['/tinymce/tiny_mce.js'],
    ...

Can you not just use:

$('.textEditor').Loader({
    url: ['/tinymce/tiny_mce.js'],
    ...
べ繥欢鉨o。 2024-10-07 10:27:10

这个问题并没有真正的答案。自从这个问题以来,我的设置发生了很大变化。我使用 Loader 加载所有文本编辑器设置,效果很好。我不知道这个问题是否可以删除或关闭,但我认为它无论如何都不会有所贡献......

实际上没有一个好的答案(在我看来,两者的价值相同),所以我接受这个所以它以某种方式被回答/关闭。

There is not really an answer to this. Since this question my setup has changed a lot. I use Loader to load all the texteditor settings and that works great. I don't know if this question can be removed or closed but I don't think it will contribute in anyway....

There is not really an good answer (both are equaly in value in my opinion) so I'm accepting this one so it is answered/closed in a way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文