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, ...How to link derived skin.css to skin.css in a smart way?How to link derived skin.css to skin.css in a smart way?
Previous
 
Next
New Post
2/26/2008 8:14 AM
 

Hi,

I have a skin.ascx with a skin.css. Now I need the same skin to have some different colors and with the same structure of skin.ascx. This a number of 5 times. So I have:

skin.ascx + skin.css

Required:

skin.ascx + skin.css
skin.ascx + skin1.css
skin.ascx + skin2.css
skin.ascx + skinN.css , N = { 1..n}.

Is there a way to link this in a smart way. That is that in skinN.css only the changes of skin.css are. Then skin.css needs to be loaded by default and skinX.css needs to be linked based on the color required for that portal. This will greatly help in making all skinN.css easy to maintain. Only the changes are present then. Of course some more kb's need to be loaded due to this "overwrite" of skin.css. But nevertheless it will help in making flawless skinN.css's.

Can anybody give a clue on how to do this. I believe the module.css is also linked to a containers.ascx this way?

 
New Post
2/26/2008 7:01 PM
 

Currently there are no CSS variations of a skin the way you describe.

So you would have to use some custom code to do this (which will only work if you hardcode it to the portal in the skin, I think)

If you add this to your skin.ascx file:

<script runat="server">
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        SetCSS()
    End Sub
   
    Private Sub AddCssLink(ByVal sName As String)
        Dim oLink As New HtmlGenericControl("link")
        oLink.Attributes("rel") = "stylesheet"
        oLink.Attributes("type") = "text/css"
        oLink.Attributes("href") = String.Concat(SkinPath, sName)
        Dim oCSS As Control = Me.Page.FindControl("CSS")
        If Not oCSS Is Nothing Then
            oCSS.Controls.AddAt(0, oLink)
        End If
    End Sub
   
    Private Sub SetCSS()
        AddCssLink(String.Concat("skin", PortalSettings.PortalId, ".css"))
    End Sub
</script>

It will load an extra CSS file based on the portal id.

(I would not replace the skin.css file with skin1.css etc, but leave all that they share in skin.css and put the rest in skinx.css)

You could also use a Javascript solution or you could use Portalsettings.PortalName instead of the portal id

btw, you can also use includes in the ascx, put everything in the ascx in "myinclude.inc" and create different ascx files with this include...

(so a change in the include wil be visible in all the skins)

 

 

 
New Post
2/26/2008 7:09 PM
 

ONe way I have done it in the past is to duplicate the file skin.ascx to for example skina.asc and create skina.css with the changes.

As far as I'm aware dnn will always include skin.css and the ascxfilename.css.


John Nicholson
 
New Post
2/29/2008 10:11 PM
Accepted Answer 

Thank you both. I did it this way. I took out the code of DNN core and looked what it does. It first adds skin.css, then portal.css and finally the <control name ascx>.css.

I created various ascx controls in one skin package on _default: So

_default/skin/skin 1 for portal 1.ascx
_default/skin/skin 2 for portal 2.ascx
_default/skin/skin.css
_default/skin/skin 1 specific 1.ascx
_default/skin/skin 1 specific 1.css (this will override skin.css and portal.css --> so in portal 1 this skin can have different background.

I think however, this skin 1 specific 1.ascx + css can also be in the portal/1 folder since they will use skin.css, then portal.css and than the specific.css.

portal/1/portal.css with changes on skin.css for portal 1 only.
portal/2/portal.css with changes on skin.css for portal 2 only.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to link derived skin.css to skin.css in a smart way?How to link derived skin.css to skin.css in a smart way?


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