The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Where and how to add javascript i need on every page? - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Documentation (https://userspice.com/forums/forumdisplay.php?fid=30) +--- Thread: Where and how to add javascript i need on every page? (/showthread.php?tid=486) |
Where and how to add javascript i need on every page? - JeroenVD - 03-02-2017 Hello, I'm trying to port a project without usermanagement into userspice. In the project are different folders with different pages. I added those folders to the array with monitored folders and so far so good. Now i try to put some generic javascript files on a location and reference them from every page. I choose the js folder under the users folder to put the generic.js. When i try to link this file from the footer.php it seems it is not working... Before digging any deeper i would like to know what is the recomanded way to do this kind of stuff. where to put the generic javascripts i see jquery and bootstrap are linked to the net. and how to reference them from different folders? Thx Jeroen Where and how to add javascript i need on every page? - mudmin - 03-02-2017 I would use the built in userspice tools for your requiring. That will deal with all the folder issues. So when you're including your javascript I would do something like... if your setup is mydomain.com/users/js and you have your javascript in mydomain.com/customstuff/js <script src="<?=$us_url_root?>customstuff/js/myjs.js"></script> Doing it with that variable will automatically grab the right path regardless of where it's being called from. Where and how to add javascript i need on every page? - raven - 03-02-2017 depends on the java script you are wanting to have java script for basic things such as mouse trails and the like go in the appproiate places in the pages you want them on head code in the <head> </head> body in the body etc. spry assets menus just put in the code where you want them to appear base code would be the way mudmin said Where and how to add javascript i need on every page? - mudmin - 03-02-2017 Try updating to version 4.2.1g in https://userspice.com/updates/ and see if that fixes your jQuery errors Where and how to add javascript i need on every page? - JeroenVD - 03-09-2017 Oke Thx, That worked well! |