I have the file code.php in the js folder of my Cakephp.
I also have the file resultcontroller in the folder src/controller/resultcontroller.php
Inside my code.php file:
<?php
$dom = new DOMDocument('1.0');
...
?>
Inside my controller:
namespace App\Controller;
...
Class ResultController extendes Controller{
...
public function littlebutton()
{
$doc = new DOMDocument();
...
}
...
When i run the app, if i call the function littlebutton it give me the error: ERROR:Class App/Controller/DOMDocument not found. When i run the app and call the code.php file (which is called with an ajax call) it works fine.
I have 2 doubts.
One is why it works with one file and doesn't work with the other? I don't do any call to any class in my code.php file and it works so i expected to do so in the controller.
Second, i read that DOMDocument is included in the php and i dont need to do anything to make it work. And now i don't know.
Please could someone give me some advise? Thank you.