Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# gedw99 8/25/2008 8:04 AM
I am wondering where is the best spot to put JavaScript files.

There a few options i see, and wondering what people can recommend here to keep me out of trouble.

1. Use Support.
This seems to be used allot for JavaScript which is used across Modules.

For example Default button does this.
Maybe its better to use the JavaScript as an embedded resource and load it up as a Web Resource each time you need it.


2. Use Template
There is no ability to create templates that also load JavaScript libraries as part of the template. I am referencing to the Admin area here.
Since templates are almost always dependent on the underlying html DOM structure, and so is the CSS i would have thought that this would be OK.

Of course we can hard code the links in the template ascx to the JS modelled inside the Template File System

3. Embed into Module.

This seems like a smart option to me?





# martijnb 8/25/2008 6:23 PM
gedw992. Use Template
There is no ability to create templates that also load JavaScript libraries as part of the template. I am referencing to the Admin area here.
Since templates are almost always dependent on the underlying html DOM structure, and so is the CSS i would have thought that this would be OK.

Of course we can hard code the links in the template ascx to the JS modelled inside the Template File System

For admin pages this would be fine to embed the js files in the template control.
3. Embed into Module.

This seems like a smart option to me?

I really thought we already had this with RegisterJavaScripts() just like we do this with stylesheets (RegisterStyleSheets, available in BaseModuleControl, which references the method in PageEngine). To my surprise it has never been implemented. Do you know RegisterStyleSheets() and do you think it would be a good idea to make the same construction for javascripts?

# gedw99 9/1/2008 1:16 PM
Yes i have already added it.

Its a very good idea.

For css and SJ i think it woudl be a good idea if the Moduel advertised it is using it, and then the template engine can load up the JS because on inspecting the Section Modules and then pumping in the JS and CSS at the Page Engine Level.

THis also allow some Compile Time checking.

G