Include Javascript in <head> Section
Posted: Fri Oct 09, 2009 11:21 am
I'm building a module that has multiple templates, some of which use javascript in the section. However, I'm not sure how to include these when my module is called.
I've seen how the Album module uses ContentPostRender() to replace the tag with a link to the static file. The problem is that I may end up with 10-15 different .js files for the different templates which is too much to include when not all of them are necessary.
There's also the option of two module calls with different actions, one for the head and one for the body but I'm trying to keep things as simple as possible!
Is there a way to only add stuff to the based on the current module template?
I've seen how the Album module uses ContentPostRender() to replace the tag with a link to the static file. The problem is that I may end up with 10-15 different .js files for the different templates which is too much to include when not all of them are necessary.
There's also the option of two module calls with different actions, one for the head and one for the body but I'm trying to keep things as simple as possible!
Is there a way to only add stuff to the based on the current module template?