Hi everyone!
I'm struggling to get a Javascript helper working in my very first
cakePHP app, and since I've tried all the ideas I had myself, I turn
to you all for help.
What I want: to include a number of custom JavaScript files from every
view of one of my classes.
What I've done so far:
1) Added this line to my controller:
var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
2) Put the scripts into app/webroot/js directory
3) Created views/layouts/default.html from the default cake template,
and changed it to include this right after the CSS:
<?php echo $javascript->link('tiny_mce/tiny_mce.js'); ?>
What I get: my view page doesn't open, and instead I can see this
error in my JS console (I'll call it ERROR1):
<b>Notice</b>: Undefined variable: javascript in <b>/var/www/
ebooks.greyspk.com/app/views/layouts/default.thtml</b> on line <b>34</
b><br />
If I then go and create from template the app/app_controller.php file
to also include the helpers line:
var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
then the above ERROR1 disappears, but I get the following:
<h1>Missing controller</h1>
<p class="error">You are seeing this error because controller
<em>JsController</em> could not be found.</p>
<p><span class="notice"><strong>Notice:</strong> If you want to
customize this error message, create app/views/errors/
missing_controller.thtml.</span></p>
<p><span class="notice"><strong>Fatal</strong>: Create the class below
in file : app/controllers/js_controller.php</p>
In fact, when I try opening the http://MYWEBSITE/js/tiny_mce/tiny_mce.js,
it shows me the same error instead of loading the tiny_mce.js
JavaScript.
Can someone please tell me how to fix this? What have I done wrong?
Thanks a lot in advance,
Gleb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---