0

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

user765368
  • 19,590
  • 27
  • 96
  • 167

1 Answers1

1

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');
CoolLife
  • 1,419
  • 4
  • 17
  • 43