views:

34

answers:

1

Hi all,

I am using cakePHP 1.26 and TinyMCE v3.38.
The .js file of the TinyMSC is stored under this directory:
http://www.mysite/js/tiny_mce/tiny_mce.js

In the page where the users can post new topic,
the URL of this page is like this:
http://www.mysite/user/newpost

Now I need to add the javascript to this page, and I have tried these:
echo $javascript->link('/js/tiny_mce/tiny_mce.js');
echo $javascript->link('js/tiny_mce/tiny_mce.js');
echo $javascript->link('../js/tiny_mce/tiny_mce.js');
But the tiny_mce.js can not be reached.

+1  A: 

I believe that Cake already knows that your javascript is in /js/ through using the $javascript->link() structure in the first place - so try

echo $javascript->link('tiny_mce/tiny_mce.js');

and see if you get anywhere.

hollsk
You should even skip the final .js: `echo $javascript->link('tiny_mce/tiny_mce');`
deceze
Yes, quite correct. It's also worth saying that if you ever get stuck then check out the code in the Bakery - it's full of real-world examples of syntax that you might not get from the documentation on your first read through: http://bakery.cakephp.org/categories/view/3
hollsk