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, ...Paths inside the ascx file...Paths inside the ascx file...
Previous
 
Next
New Post
5/4/2006 12:43 AM
 
Is there a built in string I can use that will point to the path of the ascx page that the tempalte is executing from?

For instance, if I have a resource on the page element:
<img src="right_overlay.png" border="0 alt="">

then when the page is rendered, this image src will be relative to the page that the skin is loaded on - e.g. /default.aspx, whereas the actual resource called "right_overlay.png" actually exists in the skin folder, in my case:

/Portals/_default/Skins/corporate/right_overlay.png

The only way I've found of referencing this actual file is like this:

<img src="<%=Me.AppRelativeTemplateSourceDirectory.Replace("~/", "/")%>right_overlay.png" border="0 alt="">

Is there a property I can access in the page which gives the actual path to the same folder as the ascx is loading from, or do I just do what I have above?

Also, when I need to reference things within the css file for the skin in the same way (e.g. css behviours), am I able to make the skin.css file actually skin.aspx, so that I can put server-side code in my skin for generating it dynamically? I need to do this because the paths inside the css file are relative to the page that is executing, not to the css file. The only way I seem to able to do that now is having this code in the skin.css file:

@import url(skin.aspx);

and setting the content type to "text/css" inside skin.aspx
 
New Post
5/4/2006 12:54 AM
 

I'm getting very confused here - what are you trying to do? it appears you have not got the skin path in the code - which requires a <%= SkinPath %> skin tag prefix to make it portable and recognise where it is in the installation.  so you need to change you skin to this - <img src="<%= SkinPath %>/corporate/right_overlay.png" width="300" height="300" /> for it to display live.

You don't need to do the skin path tokens in your CSS file.

Nina Meiers


Nina Meiers My Little Website
If it's on DNN, I fix, build, deploy, support,skin, host, design, consult, implement, integrate and done since 2003.
Who am I? Just a city chic, having a crack at organic berry farming.. and creating awesome websites.
 
New Post
5/4/2006 1:36 AM
 
SkinPath is the bit I needed.

With my CSS if I put the skin.css file in the folder, I can reference images (for backgrounds etc) that exist in the same folder, using something like:
.myelement {
background-image: url(my_file.png);
}

However, if I use a behaviour on my element I need to put in the whole path to the behaviour.

.myelement {
behaviour: url(mybehaviour.htc);
}

doesn't seem to work, whereas

.myelement {
behaviour: url(/portals/_default/skins/corporate/mybehaviour.htc);
}

does work properly.  So I need a way of specifying the same SkinPath property in the css file.
 
New Post
5/4/2006 9:58 AM
 

 

behaviour: is an IE only thing which you probably know.  So it has this quirk that it tries to reference relative to the page that is calling it instead of where the CSS file is, and in DotNetNuke that is the main default.aspx page in the root.

The CSS file does not get parsed when uploading the skin or at runtime so you'll need to define that rule in the actual skin file.

Put this directly in your skin:

<style>
.myelement {
behaviour: url(<%= SkinPath%>mybehaviour.htc);
}
</style>


DotNetNuke Modules from Snapsis.com
 
New Post
5/4/2006 10:10 AM
 

 

By the way.  The answer to the question about getting the path that the .ascx is in is

Me.TemplateSourceDirectory 

for Skins, this is actually what is being used in the code-behind for the SkinPath property that is exposed, but it works in any .ascx page or .aspx page.

And, just as a general good practice, you don't wan't to inlude imports that are actual .aspx pages because those pages can be executed directly which may pose a risk.


DotNetNuke Modules from Snapsis.com
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Paths inside the ascx file...Paths inside the ascx file...


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