Jump to content

How can I use $this->addJS to add an extra JS file only to the home page?


aaronjpitts

Recommended Posts

Thanks for your suggestion, but it is not for a module. I simply want to include a JS file that is needed only for the homepage. I know how to do this by adding the JS file and targeting it in the header.tpl file with smarty, but then the JS file isn't included in the CCC JS cache. Hence why I need to add it via the FrontController.

Edited by aaronjpitts (see edit history)
Link to comment
Share on other sites

Thanks for your suggestion, but it is not for a module. I simply want to include a JS file that is needed only for the homepage. I know how to do this by adding the JS file and targeting it in the header.tpl file with smarty, but then the JS file isn't included in the CCC JS cache.

 

the recommended method is to use module approach.

 

there are pre-built modules that will do this for you.

 

is this a hack just for your shop or something you plan on distributing later?

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
×
×
  • Create New...