This project is read-only.

Best place for theme dependent jscripts?

Topics: Themes
Sep 29, 2007 at 5:18 PM
Where would you place theme dependent jscripts?

Ideally of course I would like to keep them in a "theme/themename/scripts" directory or something similar to keep it altogether with the rest of the theme for possible distribution, etc...

This however causes problems since I can't maintain a correct relative link to the script in this position inside the <head> of the master page since the head is programmatically modified by the BlogPageBase class...

An absolute url would be a kludge.
Sep 29, 2007 at 6:09 PM
You should keep all your theme dependend .js file within the theme folder. The relative path must be set to /themes/themename/script.js
Sep 29, 2007 at 8:46 PM
This will not work on all pages, for example inside a post.

Without being able to use Utils.RelativeWebRoot I can't set a valid relative path that will work blog-wide from within a theme...

Any thoughts on this?
Sep 29, 2007 at 11:21 PM
In the first release we actually did have a script control that would prepend the Utils.RelativeWebRoot, but we don't have it anymore. My suggestion is that you add the script tag in the codebehind by using Page.Header.Controls.Add just like we do on the BlogBasePage
Sep 30, 2007 at 4:18 AM
Ah cool, as long as im not missing some standard BlogEngine way of doing it - adding from the code behind is fine...

Hmm when was TagName property of the HtmlGenericControl made read only and settable through the constructor only? Makes sense of course, but I am sure I used to set that along with the other properties... Meh, it has been a while though.

Anyway, everything is working as expected now.

Cheers for the input.