adrianmak Posted February 21, 2015 Share Posted February 21, 2015 I want to add a custom js for a specific page. instead of adding this js in master output template, how to add a js file to that template ? Link to comment Share on other sites More sharing options...
adrian Posted February 21, 2015 Share Posted February 21, 2015 There are lots of options, but the two I like are: Using the template conditional options in AIOM: http://modules.processwire.com/modules/all-in-one-minify/#conditional-loading Or otherwise you can add the js script call in a variable in your template, eg: $end_head = '<script src="myscripts.js"></script>'; Then in your main.inc or whatever file is your master template, just echo out $end_head before the closing </head>. Of course you could also do this with $end_body if more appropriate for your script file. 2 Link to comment Share on other sites More sharing options...
pwired Posted February 21, 2015 Share Posted February 21, 2015 Good reads: https://processwire.com/talk/topic/2782-template-design-better-route/https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now