Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Accessing SkinPath From JavaScriptAccessing SkinPath From JavaScript
Previous
 
Next
New Post
5/12/2009 10:37 AM
 

Could anyone tell me how to access the SkinPath variable from within a block of JavaScript code? I've seen several examples of referencing SkinPath from the markup (<%=SkinPath%>), but I'm not sure how to translate that into JavaScript.

 
New Post
5/12/2009 2:28 PM
 

Actually, I do have the following working:

var x = "<%= SkinPath %>";

The key to that was to have the script running in the same ascx file that inherits from DotNetNuke.UI.Skins.Skin. I have a few ascx files that merge together (header, skin and footer). Header and footer inherit from System.Web.UI.UserControl, so those controls had no idea what SkinPath was.

The next challenge is, "How do I get the SkinPath over to an external JavaScript file?"

 
New Post
5/12/2009 4:42 PM
 

I've implemented a solution that involves storing the SkinPath into a hidden field in skin.ascx, then accessing that hidden field in header.ascx, via inline JavaScript.

The next challenge is to move the JavaScript to an external file. The problem is, how do you declare <script src=XYZ.js> when you don't know where XYZ.js is until you run the script?

 
New Post
5/13/2009 4:47 AM
 

If you write the js variable to the page, any JS in an external file could access it as long as it is loaded after the variable on the page.
So i'm not sure why you want to write the varialbe to the external JS file?
 

 
New Post
5/13/2009 10:46 AM
 

Ah yes. Thanks. That saves a few lines of code.

I'm also using the SkinPath now to tell my Header.ascx where to find the external JS, before actually using it. Everything is working beautifully.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Accessing SkinPath From JavaScriptAccessing SkinPath From JavaScript


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out