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, ...Adding stylesheets to a skin??Adding stylesheets to a skin??
Previous
 
Next
New Post
5/6/2007 11:37 PM
 

I noticed that the default skins has a runat server on both the head and the style tag.  In a skin, how would a person dynamically add a link to another style sheet to the <head/> block or possibly add styles to the <style/> block?  I have a skin that will have a ton of variations and I would like to have them all in one directory sharing a single skin.css file for most things and then a skin file of the name of each variation (like MyVerticalSkin.css, MyFixwidthVerticalSKin.css, MyHorizontalSkin.css, etc).  I would like to have a vertical and horizontal menu versions, fixed and full width versions and possibly one with or without a side panel of each of the prior along with each having around 10-14 different color versions of each. 

 
New Post
5/7/2007 12:12 AM
 

You can do this server-side or client-side. On the server-side, you would use --

Dim DefaultPage As CDefault = DirectCast(Page, CDefault)
DefaultPage.AddStyleSheet("
UniqueIDForYourStylesheet","VirtualPathToCSSFile")

On the client-side, you can use code like this to inject a stylesheet on-the-fly:

function addStyleSheet(url)
{
         if (document.createStyleSheet)
             document.createStyleSheet(url);
         else
         {
             var head = document.getElementsByTagName("head")[0];
             head.innerHTML += "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + url + "\" />";
         } 
}

Nik

 


Nik Kalyani
Co-founder
DotNetNuke Corporation
Blog | Twitter | FaceBook
 
New Post
5/7/2007 6:01 AM
 

Thanks!

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Adding stylesheets to a skin??Adding stylesheets to a skin??


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