Jump to content

how to add js file for a specific template ?


adrianmak
 Share

Recommended Posts

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.

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...