I am developing a cakePHP application and I want to use the Dojo toolkit, which is a javascript framework. I want to associate Dojo with my application. I have completed the following steps:
1) Added the folder "dojo1.9.3" (subfolders "dojo", "dojox", "digits") in the app / webroot / js folder.
2) Created the view home2.ctp in the app / view / page / folder, which contains the following code:
<?php
echo $this->Html->script('/js/dojo-1.9.3/custom');
?>
<h1 id="greeting">Hello</h1>
3) Created a custom.js file to use dojo:
require([
'dojo/dom',
'dojo/fx',
'dojo/domReady!'
], function (dom, fx) {
var greeting = dom.byId('greeting');
greeting.innerHTML += ' from Dojo!';
fx.slideTo({
node : greeting,
top : 300,
left : 450,
}).play();
});
After accessing the home2 page above, the code should change the h1 form of the dom form, mapping "Hello" to "Hello from Dojo!" and animate it using the Dojo function. But it does not work, it shows only "Hello." Dojo code works fine without cakePHP.
DojoCake, :
1) , cakephp .
2) :
: include (cake\bootstrap.php): :