user765368
user765368

Reputation: 20356

Load Vendor javascript files CakePHP 2

does everybody know how to load javascript files (as opposed to php classes) from a third party library (placed in app/Vendor/LibraryName). I tried to look into App::import(), but apparently it's only to import classes. I'm trying to use Jssor slider library in a CakePHP 2.5.5 application.

Thanks in advance for any help

Upvotes: 0

Views: 624

Answers (1)

CoolLife
CoolLife

Reputation: 1479

if it's a .js file is best to put the files on /app/webroot/js/jssor_library.js this route. then you can use the library on the controller or the view by loading so:

echo $this->html->script('jssor_library');

once loaded, the code is the same as when you use it regularly.

good if an entire folder, then copy the folder path and calls the library you're using, including the name./app/webroot/js/folder_jssor/jssor_library.js

echo $this->html->script('folder_jssor/jssor_library');

Upvotes: 1

Related Questions