You need to Register for free and Login to post a message in the forum.

Forum

Subject: SkinPath in container ascx file
Prev Next
You are not authorized to post a reply.

Author Messages
andyb1979
Nuke Pro
Nuke Pro
Posts:62

23 Feb 2008 6:09 PM  

Does anyone know if you can access the SkinPath tag in a container ascx file? I keep getting exceptions when I do this. It says:

"CS0103: The name 'SkinPath' does not exist in the current context"

What im trying to do is inject a conditional stylesheet for IE6 for my containers. I found a post somewhere on the web saying I can add this to my ascx file:

<script type="text/javascript">

if (document.createStyleSheet)
    document.createStyleSheet("<%=SkinPath%>/containerIE6.css");
</script>

However when I add it to a container I get the above exception.

Does anyone know a way to inject custom stylesheets for containers to view them in IE6?

Thanks!

AndyB


Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2357


24 Feb 2008 10:16 AM  
I haven't ever tried to do something like that, but you might find it easier to use

         DotNetNuke.UI.Skins.PortalSettings.ActiveTab.SkinPath

directly.

The error message that you received seems to indicate that skinpath isn't accessible directly in the container.

Are you trying to put some IE-specific stuff in a container to solve a problem?  You might want to take a look at the recent issues of DNNCreative that deal with skin creation:
Lee deals specifically there with creating module level files to deal with specific browser issues.




Joe Craig
DNN Creative Support
Subscribe to the website
andyb1979
Nuke Pro
Nuke Pro
Posts:62

01 Mar 2008 4:53 PM  
Hi Joe,

Thanks for your reply. I've been playing around with just getting my skin.css/container.css file to work in one browser so far(!!) - but Im coming to the point where I need to add a few extra stylesheets.

I *think* its possible to do this in the code-behind. Being a newbie to asp.net Im really stabbing in the dark. I found a snippet here:

http://www.velocityreviews.com/forums/t89859-dynamically-add-link-to-css-stylesheet.html

HtmlGenericControl link = new HtmlGenericControl("LINK");
link.Attributes.Add("rel","stylesheet");
link.Attributes.Add("type","text/css");
link.Attributes.Add("href","mydefinedstyle.css");
Controls.Add(link);

However, the namespace you gave me doesn't exist on my installation of dotnetnuke? (Im running on a local development machine in VWD2008).

In DotnetNuke.UI.Skins I only have:

Controls, CustomAttribute, NavObjectBase, Skin, SkinControl, SkinController, SkinFileProcessor, SkinInfo, SkinObjectBase, SkinThumbnailControl.

Thanks,

AndyB




Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
andyb1979
Nuke Pro
Nuke Pro
Posts:62

01 Mar 2008 4:57 PM  
Wait, im so dumb.. Inside the code-behind of a skin, you can do this:

string cssFile = Path.Combine(this.PortalSettings.ActiveTab.SkinPath, "test.css");

Then add it as above

And it works!! \o/


Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2357


01 Mar 2008 5:38 PM  
Andy,

My general rule is to NOT encourage newbies to step outside of the existing framework too quickly. Instead, study the framework and see how to use it to accomplish what you need. Rarely is it necessary to make additions. I'm still not understanding why you need to load extra css files.

The tutorials I mentioned in my last message show how you can load additional css files for specific tasks. There are also skin files available that change "on the fly." These probably border on stepping outside of the framework, but they do show you some things that can be done.

On the other hand, if you have a solution and it doesn't break other things, more power to you!

Joe Craig
DNN Creative Support
Subscribe to the website
andyb1979
Nuke Pro
Nuke Pro
Posts:62

02 Mar 2008 10:31 AM  
Well, Im not trying to serve extra skin files, but I am trying to attach some browser-specific CSS to make my skin work across browsers.

In particular my container is a rounded elastic rectangle with png drop-shadow. This won't work in IE6 or below so I have a different css file that serves GIFs. So the additional CSS files only have a few overrides for rules that don't work in certain browsers.

I wanted to do it without javascript as if someone has JS off then your css file doesn't get served. I will check out those tutorials though as Im still having trouble attaching the css for the container (for the skin it works perfectly).

Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
andyb1979
Nuke Pro
Nuke Pro
Posts:62

03 Mar 2008 4:35 AM  
Wait - this issue has been resolved. See the thread here:
http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/109/threadid/209121/scope/posts/Default.aspx

this.SkinPath in the container code-behind points to the current container directory

Apologies if I didnt explain the problem well enough and thanks for your help,

AndyB

Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2357


03 Mar 2008 9:30 AM  
I'm glad that you found a solution!

Joe Craig
DNN Creative Support
Subscribe to the website
leesykes
DNN Creative Staff
Nuke Master III
Nuke Master III
Posts:3352

05 Mar 2008 10:36 AM  
Hi Andy,

This looks like a really good solution for CSS hack management, would you be able to email me some example files so I can have a look through it, I think everyone may benefit from a tutorial on this.
lee at dnncreative.com

Thanks,

Lee Sykes
Site Administrator
Subscribe to the website : DotNetNuke Video Tutorials : The Skinning Toolkit : DotNetNuke Podcasts

Twitter: www.twitter.com/leesykes

Lee Sykes's Facebook Profile
andyb1979
Nuke Pro
Nuke Pro
Posts:62

05 Mar 2008 12:42 PM  

Hi Lee,

Sure, no problem. To be honest, Im really surprised no-one seems to have thought of it already. I'm a .NET developer (not ASP.NET) so I wanted to stay away from horrible javascript and ended up going down this route.

Anyway, I posted an example here on this forum (from memory):

http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/109/threadid/209121/scope/posts/Default.aspx

Is this any good? If not I can come up with a proper code example for you, but give me a couple of days as Im really busy at present!!

Andrew


Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
leesykes
DNN Creative Staff
Nuke Master III
Nuke Master III
Posts:3352

06 Mar 2008 3:23 AM  
If possible, it would be really useful to look through a full code example, there is no rush, but if you could email something across it would be really appreciated,

Thanks,

Lee Sykes
Site Administrator
Subscribe to the website : DotNetNuke Video Tutorials : The Skinning Toolkit : DotNetNuke Podcasts

Twitter: www.twitter.com/leesykes

Lee Sykes's Facebook Profile
andyb1979
Nuke Pro
Nuke Pro
Posts:62

06 Mar 2008 7:54 AM  
Sure, no problem. I'm actually working on a skin for a non-profit organisation, so if I just send you a copy of that where Im up to at the moment, it should be enough to demonstrate the concept.

There is one thing Im still struggling on though - which is quite critical to the success of this method.  In my skin_IE6.css file, Im trying to apply the DXImageTransform to load PNGs in certain cases, but its not working - I just see a blank area.

So in the main skin.css file, I apply the PNG as a background image (this skin is seen by firefox etc...), then in the skin_IE6.css file, I override it like this

.nav_bar_right
{
background:transparent;
filter:progid: DXImageTransform.Microsoft.AlphaImageLoader(
src='/images/nav_bar_right.png',
sizingMethod='scale');
}
In fact, when I apply this fitler directly in the original skin.css file (so no extra css files added, just set the filter in the original skin) and load the webpage in IE6/7, I still just see a blank area.

I know the css class is being applied as if I set background:#f00 it changes colour, but the filter doesnt seem to work.

I remember reading somewhere that the URL of the png image for the DXImageTransform must be absolute to the wwwroot directory, but I tried that and it also didnt work, e.g.
.nav_bar_right
{
background:transparent;
/* Resolve to absolute skin path */
filter:progid: DXImageTransform.Microsoft.AlphaImageLoader(
src='/Portals/_default/RRR2008/images/nav_bar_right.png',
sizingMethod='scale');
}


^^ That also has no effect even if I put it in the original skin.css file, so its not related to adding additional css files.

Do you have any ideas about that? I'd ideally like to resolve the png's using CSS alone, with no javascript.

Thank you,

AndyB

Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
andyb1979
Nuke Pro
Nuke Pro
Posts:62

07 Mar 2008 2:45 PM  
I fixed this (PNG filter in CSS file).

You have to add the full path to the image as follows:

#nav_bar_shadow
{
background:transparent;
filter:progid: DXImageTransform.Microsoft.AlphaImageLoader(src='/rockrhymereason/Portals/_default/Skins/RRR2008/Images/nav_bar_shadow.png',sizingMethod='scale');
}

where my site is http://localhost/rockrhymereason/

Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
jcator
DNN Creative Magazine Subscriber
Nuke Newbie
Nuke Newbie
Posts:5

07 Jul 2008 2:23 PM  

Thank thank you, I pulled my hair out I read the first part of the post and when I would use view in browser from visual developer the pictures displayed perfect. It did not work however in DNN, fortunatly I read the rest of the post, how strange; with the full path works great now.

 

Thank you

andyb1979
Nuke Pro
Nuke Pro
Posts:62

07 Jul 2008 3:08 PM  
When you deploy your skin on a server, make sure you change the path again. I used the .NET Method Server.MapPath to find what was the actual path of my DotNetNuke installation. I wrote a small method in the code-behind to load in the css file, swap out a token <%= SkinPath %> for the actual server path and then serve the modified CSS file.

Sites I made thanks to DNNCreative vids!
Rock Rhyme & Reason Fest | The Big Match | Calvary Stockport | Stephen Webster
jcator
DNN Creative Magazine Subscriber
Nuke Newbie
Nuke Newbie
Posts:5

07 Jul 2008 10:32 PM  

Anyone know how to make this work in a pure css skin like red leaf?

jcator
DNN Creative Magazine Subscriber
Nuke Newbie
Nuke Newbie
Posts:5

08 Jul 2008 1:41 PM  
I got it also with css skin filter works same slightly diffrent strategy was needed.
You are not authorized to post a reply.
Forums > DotNetNuke® > DotNetNuke® Questions > SkinPath in container ascx file



ActiveForums 3.7

Latest Forum Posts

Need UK Hosting by Liz
Hi,Not sure if this is the right place, but I am currently with Power DNN, and whilst I am a big fan...
RE: search not working by sanju_k1421
host==>admin search page that is set both limits min //max page reindex content button is ...
RE: No Access for me too by leesykes
hello,I have fixed the problem and I have given you a years access beginning from today December 2nd...
old skins for DNN 4.9.0 ? by clippy
Hello from France My question is about the videos for beginners, and specially n° 3; I'm working...
Web.config Error by derpir
HelloI got this error, does this seem familiar to you? Can anyone say how to fix this error?Error 98...
No Access for me too by ristori
I suscribe for the magazine novembre 2008 13. I receive this ticket from Paypal : Prix de l...
How can I list our offices by country by bluehoops
Hi everyone!Apologies if this is a simple question, but it is driving me nuts.I run a small ISV and ...
RE: DNN Creative vs FireFoX V3 by DavidWSnow
It now looks like the error'ing extension is StumbleUpon and it effects FireFox on some, but not all...
Issue 39 Authentication by DavidWSnow
I was glad to see you address this topic. When LiveId was first added to DNN, I tried to implement i...
RE: (catalook) Itempane changes on product pages ?? by Vilaplana
Hi, I think the problem is been caused by your skin and not by Catalook itself.  In the main page, C...
Yahoo Answers by cdtguru
Hey, i was wondering if anyone knew of a module that would create a similar system to Yahoo Answers...
(catalook) Itempane changes on product pages ?? by Gaz35
Hi , hi , I don’t know if you can help me , here is the site in question http...
RE: Virtual Pc 2007 help by jeff@zina.com
You need to get the Virtual PC's network set up.  Might check the Virtual PC news group: http://www...
DNNCreative Just Keeps Getting Better by jeff@zina.com
Kudos on issue 39, the article on importing large quantities of data was both timely for me and spot...
RE: Videos by clippy
Hello from France My question is about the videos for beginners, and specially n° 3; I'm working...
skinning trouble by derpir
HelloI have uploaded a skin to my DNN-website, but I want to make som changes. I have made some chan...
RE: Column width in UDT by VickySwift
In case anyone else is looking for the answer to this, I have been able to add the headers back in b...
RE: search not working by jncraig
Did you either reindex the site to turn on the scheduled task to do it?
RE: Template Issue by jncraig
No, you need to install your custom modules before you use the template.
RE: error message in registration page by jncraig
I'm not sure that you can avoid them, short of rewriting the module.You might want to investigate Dy...
DotNetNuke Modules
RSS Feeds