2

I suspect this is something to do with URL rewriting but I'm a little stuck.

I'm using the cakeDC tinyMCE plugin which works fine on my local web server but when I upload the whole cakeapp onto a testing url (I'm going from localhost/knowledgebase to intranet/knowledgebase) everything works apart from the TinyMCE JS include.

Heres the problem line -

<script type="text/javascript" src="/knowledgebase/TinyMCE/js/tiny_mce/tiny_mce.js"></script>

When I click this in dev tools it can't load the file. Other script src's work fine such as:

<script type="text/javascript" src="/knowledgebase/js/respond.min.js"></script>

The difference is I'm using the CakeDC TinyMCE helper to produce the link from the view, the other links all point to files in the webroot/js folder.

Can anyone point me in the right direction?

Thanks in advance.

Jimothey
  • 2,414
  • 9
  • 41
  • 66

1 Answers1

0

What I always do is making sure the $this->webroot available in views is accessible in my JavaScript like so:

$this->Html->scriptBlock('var webroot = "' . $this->webroot . '"');

So now I can use the webroot as a path reference for path declarations in my JS. Since working with dots and double dots isn't that readable or usable.

It might be possible I am overlooking some features of Cake, but this has been my approach for every project in Cake since the beginning.

Jelmer
  • 2,663
  • 2
  • 27
  • 45
  • Thanks for the reply, the JS file in question isnt actually in webroot its in the TinyMCE plugin directory (Plugin/TinyMCE/View/Helper/TinyMCEHelper.php). The TinyMCE helper injects the script tag into the head of the view. – Jimothey Jun 07 '13 at 13:33
  • Can you clearify your question? I am not entirely sure what the problem is then :) – Jelmer Jun 07 '13 at 21:37