469,963 Members | 1,241 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Customizing Theme File Processing (more than just .css, .jpg, etc)

Hello,

I'm working with some third-party JS code, such as mootools and
moo.fx, among a few others. They have some really nice "flashy"
features, such as fading from one color to another to bring
attention. I would like to use these settings, but I am currently
restricted to a single theme (more specifically, one color scheme),
because you must specify the start and stop color in JS.

If I could "theme" JS files, then I could create a JS file with a ton
of constants. By creating a .js file in a Theme's directory, it would
register a:
<script type="text/javascript" src="app_themes/theme_name/
file_name.js"></script>

Doing so would act like a .css file except for my .js file. Then in
my file_name.js file:

var FadeFromColor = "FFF";
var FadeToColor = "000";
-----------------------
The above is just an example, of course. Is there any way I can
extend PageTheme to do these types of things? Is there any kind of
PageTheme Provider that I can access?

I've searched all over the net, but I'm unable to find anything. Any
sort of information would be appreciated.

Thank you
-eli

Jun 12 '07 #1
1 1180
For anyone that cares, I gave in and did it OnInit. I would ideally
like to do it through a provider of sorts, but for now this will work:

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

if(!string.IsNullOrEmpty(Page.Theme))
{
DirectoryInfo dir = new
DirectoryInfo(Page.Server.MapPath(Page.ResolveUrl( "~/App_Themes/" +
Page.Theme)));

FileInfo[] files = dir.GetFiles("*.js",
SearchOption.TopDirectoryOnly);

foreach(FileInfo file in files)
{

Page.ClientScript.RegisterClientScriptInclude(this .GetType(),
file.Name, Page.ResolveUrl("~/App_Themes/" + Page.Theme + "/" +
file.Name));
}
}
}

grexi...@gmail.com wrote:
Hello,

I'm working with some third-party JS code, such as mootools and
moo.fx, among a few others. They have some really nice "flashy"
features, such as fading from one color to another to bring
attention. I would like to use these settings, but I am currently
restricted to a single theme (more specifically, one color scheme),
because you must specify the start and stop color in JS.

If I could "theme" JS files, then I could create a JS file with a ton
of constants. By creating a .js file in a Theme's directory, it would
register a:
<script type="text/javascript" src="app_themes/theme_name/
file_name.js"></script>

Doing so would act like a .css file except for my .js file. Then in
my file_name.js file:

var FadeFromColor = "FFF";
var FadeToColor = "000";
-----------------------
The above is just an example, of course. Is there any way I can
extend PageTheme to do these types of things? Is there any kind of
PageTheme Provider that I can access?

I've searched all over the net, but I'm unable to find anything. Any
sort of information would be appreciated.

Thank you
-eli
Jun 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.