Best practice for including javascripts
What are the recommended practice for including javascript? We create a template with xhtml block region. And then on the individual pages that use js, we edit the xhmtl to include the scripts.
I was wondering if there's a better way to be doing this. Certain pages have multiple scripts.
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Tim on 11 Jun, 2010 09:06 PM
Hi Stephen,
This is the way we approach things with our sites in Cascade Server as well.
Once Cascade Server 6.7 is available, I can see this getting even easier with the use of Data Definition Blocks. You could potentially write a Data Definition that contains multiple file choosers, then simply select the javascript files to which you wish to link. A Velocity or XSLT Format would then take the information and transform it into the appropriate tags to link to each javascript file.
Let me know what you think.
2 Posted by ssuh on 17 Jun, 2010 02:57 PM
In the data definintion builder, i see a button for Block now. I suppose one could create an xhtml block and link to the js. Then just add multiple blocks if needed on the page.
Support Staff 3 Posted by Tim on 17 Jun, 2010 03:12 PM
You could certainly do this as well, however this may create confusion for your end users when they edit those pages. It could also clutter up the editing interface for them. The method you are currently using is good because those blocks are plugged in in the background and end users never see nor do they have to worry about what is happening with the javascript.
This method will work well when Data Definition blocks are available (as I mentioned above). End users won't see the block choosers when they are editing the DEFAULT region of the page and instead can concentrate solely on the content that needs to be there.
Tim closed this discussion on 17 Jun, 2010 03:12 PM.