I am confused by this because I can not find a good documentation on how to do this, I have a jquery file "ChemCopter" is located in my CakeFop site folder:
/app/webroot/js/index.js
I'm trying to include it with my view
& lt ;? Php echo $ javascript- & gt; Link ('index', incorrect); ? & Gt; But I get:
Fatal error: Call a member function link on a non-object in / var / www / site1 / app / Views / uiemails / index.ctp on line 4 I have also put it at the top of my layout:
I appreciate any suggestions as to what I need to do to make this work .. Thanks
Edit
( I have been using CakePaper version 1.3.2 I have tried now:
By putting it in my controller:
var $ helpers = array ('form', ' Html '); Again, in my opinion:
html-> script ( 'Index', incorrect);> & gt;; But I still get:
Fatal errors Call on a member function script on non-object: / var / www / site1 /app/views/uiemails/index.ctp on line 4
It looks like you are forgetting to include JavaScript Helper in your controller. The syntax also depends on which version of kppp you are using In 1.3.x, the JavaScript Assistant has been deprecated and you instead have HTML Use of.
Your Controller:
& lt ;? Php class bakery Controller Expands AppController {// If Not Required You are using HTML Assistant because it is included by default! Var $ helpers = array ('form', 'html', 'javascript'); }? & Gt; Your View:
& lt ;? Php echo $ this- & gt; Javascript-> Link ('whatever'); ? & Gt; Or cake PHP 1.3.x:
and HTML-> gt; Script ('whatever'); ? & Gt; and in your file system:
/app/webroot/js/whatever.js
related documentation
- To use 1.2.x JavaScript Assistant
- How to include non-default assistants to use 1.3.x HTML Helper
- Includes script
Comments
Post a Comment