Sunday, September 05, 2010
  Search
 
Register
Login
 
How to Install DotNetNuke 5.0 Cambrian and Video
 This video tutorial covers installing using the Custom installation option, with SQL Express and also an external SQL Database. Find out more about which package to download and how to kick off the ...

Find this article and more in the category

Read This Article . . .

I Need to Modify the What to Install DNN? What in the World is a Web.Config File Anyway??
 If you're wondering what in the world a web.config file is, then wonder know more. . .in about 5 minutes, you'll know more than you do now and be well on your way to moving forward.

Find this article and more in the Web.Config category

Read This Article . . .

Using DNN to take Advantage of GoDaddy Domain Names
Let's face it, GoDaddy is cheap. Pay for the hosting services and the domain names are $1.99, not a bad deal. And even without hosting services, you can pick up domain names for as low as $6.99. Put ...

Find this article and more in the category

Read This Article . . .

Adding Google AdSense with Video
Adding Google AdSense to your DotNetNuke portal has never been easier. By default, a Google AdSense module is added the list of installed modules when your DNN portal is first created. It's easy to ...

Find this article and more in the Modules category

Read This Article . . .

Resolving Troubles with DNN User Controls During Module Development & Compilation
So, you've created a module in a separate project using some DNN User Controls and now you're receiving errors and can't compile? If you are using these controls (list below) on your module using ...

Find this article and more in the category

Read This Article . . .

How To Customize the Privacy and Terms Links on Your DotNetNuke Portal
Straight out of the box, DotNetNuke already has a lot of things covered. But, what do you do when you are ready to begin customizing your site. Sometimes, it’s not so easy to figure out how to make t...

Find this article and more in the category

Read This Article . . .

Generate a Module Data Access Layer With CodeSmith
With the introduction of some of the newer DNN tools, building a custom module is becoming more and more easy. With the right tools, you can have a custom module built in no time flat. This will outl...

Find this article and more in the DotNetNuke category

Read This Article . . .

How to Install and Configure ActiveDirectory Provider for DotNetNuke 5.0
 The directions for installing and configuring extensions in DotNetNuke 5.0 are very similiar, but slightly different than from previous versions. Here's how to install the ActiveDirectory authentica...

Find this article and more in the category

Read This Article . . .

Setting Up Multiple Websites
You can create multiple distinct, (mainly) independent websites with one instance of a DNN installation on your web account. In lamens terms, this means that you can purchase ONE web hosting accoun...

Find this article and more in the category

Read This Article . . .

How To Customize the Privacy and Terms Links on Your DotNetNuke Portal
Straight out of the box, DotNetNuke already has a lot of things covered. But, what do you do when you are ready to begin customizing your site. Sometimes, it’s not so easy to figure out how to make t...

Find this article and more in the category

Read This Article . . .

Recently Added Articles

Minimize
Article List

 

New "Styles" SkinObject Found in DotNetNuke 4.9

11/7/2008 12:12:35 PM - By Briana Tarrance

Category: DotNetNuke | | Comments 5

 

 

Related Links

One more addition has been added to the developer's DotNetNuke skinning toolbox with the release of DotNetNuke 4.9. Introducing...the Styles SkinObject. This little object is a very welcome addition and helps ease the burden of delivering a site layout to the myriad of browsers and screen sizes of site visitors.

Using the skin object is just like using any of the other DotNetNuke skin objects. Basically, you need to register the object on your skin and then apply the object.

Registering is easy. Simply add this to the top of your .ascx file:

<%@ Register TagPrefix="dnn" TagName="STYLES" Src="~/Admin/Skins/Styles.ascx" %>

Then, anywhere on the page you can apply the object. The object doesn't actually display anything, so it doesn't necessarily matter where you add it. However, you may consider simply adding it to the bottom of your page just to keep things free from confusion and clutter.

<dnn:STYLES runat="server" ID="StylesIE6" Name="IE6Minus" StyleSheet="ie6skin.css" Condition="LT IE 7" UseSkinPath="true" />

If you copy and paste the above line into your file, you can click on it to select it and then hit F4 in Visual Studio to view the properties of the tag.

So, now that we know how to apply it, lets go over the properties of the DotNetNuke Styles SkinObject.

Properties

  • ID This is the unique name you want to give to your object. This is the name you would use to refer to the object programmatically.
  • Condition - this is the conditional usage statement. See below for more information....
  • Enable Theming - leave this values at their default. You can't see it, so need to theme it.
  • Enable Viewstate - leave this value at its default
  • IsFirst - This is a boolean value (True/False) that basically says, "Do you want this skin to be loaded first?" The default property value is set to False. Remember, CSS is applied in order...so if two of the same styles are found in two different CSS files, the last one loaded will be applied.
  • Name - This is the name that will be used to identify the css stylesheet in the <link> tag from the DOM
  • runat - Leave this alone...obviously any server side tag has to have the "runat=server" attribute
  • StyleSheet - this is the name of the StyleSheet that you are wanting applied via this SkinObject
  • UseSkinPath - this is a boolean value (True/False). When true, the CSS file will be assumed to be located in the same folder as the current Skin you are adding the object to.
  • Visible - this is a boolean value (True/False)...Leave it as it, because you can't see it anyhow.

Conditional statements

 

 If you look in the code behind of the skin object you can see from the code that the required tags are automatically added to the conditional statement you supply in the Condition property. So, essentially you just need to fill in the text that will replace the {0} variable.

openif.Text = String.Format("<!--[if {0}]>", Condition)
   ....
closeif.Text = "<![endif]-->"

Now, if you look at the property box image above, you'll see that the supplied condition is "LT IE 7". What this is doing is telling the browser , "If the user's browser is Less Than Internet Explorer 7, I want you to use the ie6skin.css file located in my current skin folder."

Example Conditional Statements

 

Note the usage of "gt", "lt" and "lte" which stand for "greater than", "less than" and "less than or equal", respectively.

<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>

More examples:

<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>
 
<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->
 
<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->
 
<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>
 
<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]><![endif]-->

Detecting FireFox browsers

If the following code fails to exclusively detect Firefox..
 
    <!--[if !IE]>    ...statements...  <![endif]-->  
Use "Downlevel-revealed Conditional Comments" to get it working...
 
    <![if !IE]>    ...statements...  <![endif]>  
 
Example to force Firefox to use an exclusive css..
 
  
  <![if !IE]>    <link href="css/ff.css" rel="stylesheet" type="text/css" />  <![endif]>

And that's it. Pretty cool, right? I think this SkinObject is going to be a great addition to the core objects and will help us get those skins rendering correctly for a lot more people.

Wanna make sure those conditional statements are working properly? Check out my blog post on viewing your site in many browsers at once or how to test your site easily in different IE versions on your local machine.

Want more CSS control? Check out theveCSSViewer module to truly take command of your CSS Styling on DotNetNuke websites.

 


 
 
Copyright 2008 by Virtual-Essentials.com Privacy Statement    Terms Of Use