Posted on: 10/30/06 05:33am
By: Anonymous (paslatek)
I'm trying to use a javascript file for one of my blocks.
I don't know where to put the html statements for include this JS file.
- If I put in the "lib-custom" file, I'll get the "cannot modufy header" error.
- If I put in my theme template, this block will work only when using my theme.
any suggestion or idea please ?
Where is the best place to include javascript files
Posted on: 10/30/06 03:42pm
By: Dirk
Script tags can be used anywhere in an HTML document, so unless it's something that you want to use multiple times but only load once, you could put it directly into your block.
Otherwise, use the function CUSTOM_templatesetvars in lib-custom.php to define your own header variable that contains your JavaScript code.
bye, Dirk
Where is the best place to include javascript files
Posted on: 10/31/06 03:18am
By: Anonymous (paslatek)
Thaks for your reply !
I've finally include my script in my block.
but at the start of my reflexion, I thought to include a script file with custom function for many of my blocks. So I search a "generic place" like a custom_functions.js to use.
If I understand what you said, I think that CUSTOM_templatesetvars will give me this ability !
Many thanks Dirk