Skip to content
Advertisement

Can’t include js files in php file on cpanel

I am trying to use a JavaScript library (from GitHub) on my website but I can’t get it to work. It works when I set it up in VS code but not when I upload my code to cpanel (along with the required files). The website is a wordpress site so I just create page templates and link the templates to the specific pages. I have uploaded all of the code and files correctly and this is how I have tried to include them:

JavaScript
JavaScript

I also tried using <?php include '/home/fittecha/repositories/particles.js/demo/js/app.js'; ?> etc, but that didn’t work either. Please advise.

Advertisement

Answer

I managed to sort it out. I changed the html to a php include function and placed it at the bottom of my document:

JavaScript

I am not sure why this didn’t work before when I tried it but it’s all working now

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement