daveh / php-mvc

A simple PHP model-view-controller framework, built step-by-step as part of the "Write PHP like a pro: build an MVC framework from scratch" course on Udemy.
https://davehollingworth.com/go/phpmvc/
MIT License
780 stars 311 forks source link

TinyMCE editor #79

Open pagodzik opened 3 years ago

pagodzik commented 3 years ago

Hi

I installed TinyMCE by composer. So we have path "/vendor/tinymce/tinymce/tinymce.js" How should I include this to my twig html? All js I have in public/js/ - shoud I move there also tinymce files ?

Regards

daveh commented 3 years ago

Composer was designed for PHP packages, i.e. PHP code that will be used on the server. By design, files not in the public folder can't be accessed in a browser, so you can't access that JavaScript file in the browser. You have a couple of options - for TinyMCE, the simplest is to load it from a CDN - details here (scroll down to "Get Started with TinyMCE").

Alternatively you could copy the relevant files from the vendor folder to the public folder, you can do this manually or use a Composer script to do this automatically every time the package is updated.