PhalconException: JsController handler class cannot be loaded

im including my javascript file thru this:

<script src="js/vendors/jquery-1.10.1.min.js"></script> or {{ javascript_include("js/vendors/jquery-1.10.1.min.js") }}

but im getting this error (PhalconException: JsController handler class cannot be loaded) whenever i click the link.



85.3k

It means the file does not exist at:

public/
 js/
  vendors/
   jquery-1.10.1.min.js

it exist. but when i try to move the jquery file one directory down to js folder it work! but under the js/vendors folder it doesnt.

[UPDATE] i configured my app url to http://myapp.dev but when i access my app thru this url (http://localhost/myapp/) the jquery file under the js/vendors folder works! weird! i think this has effect on the .htaccess file?



85.3k

You have to adjust your baseUri according to the host:

$di->set('url', function(){
        $url = new \Phalcon\Mvc\Url();
        $url->setBaseUri('/'); // http://myapp.dev
        $url->setBaseUri('/myapp/'); // http://localhost/myapp/
        return $url;
});
edited Mar '14

im using this setting

$di->set('url', function(){
        $url = new \Phalcon\Mvc\Url();
        $url->setBaseUri('/'); 
        return $url;
});

to access my app http://myapp.dev, but i tried to change it like this

$di->set('url', function(){
        $url = new \Phalcon\Mvc\Url();
        $url->setBaseUri('/myapp/'); 
        return $url;
});

and access at the same url (http://myapp.dev) the jquery file under the js/vendors folder works fine as well as http://localhost/myapp/