Click here to Skip to main content
Click here to Skip to main content

Basic Skin Creator for DotNetNuke

, 8 Dec 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
An application to create skins for DotNetNuke portals with a browser preview
Screenshot - BSC_Install

Table of Contents

Introduction

I am a huge fan of DotNetNuke (DNN) and what you can accomplish with it. It is a wonderful framework that you can use to create websites where your users can quickly and easily take control of their own content. One of the greatest strengths of DotNetNuke is that it separates the content from the presentation via skins. You are given freedom to do pretty much what you want to with it.

This flexibility is also one of the greatest obstacles when first learning to skin DNN. The default skins that come with DNN use a gradient that makes the menus hard for me personally to read. So, I wanted to change it. After many hours and even buying a set of modules that promised it was going to be easy, I still couldn't change the one thing that I really wanted: the menus. So, I did what any good programmer would do. I wrote a program to solve the problem for me.

Background

Most of the websites I work with have a following that really doesn't care how the site looks (family, small club and organization sites). They just want the content. I don't really have the time or the money to invest in learning Photoshop or similar programs. I just wanted a tool that would allow me to choose the colors and fonts for the basic elements of the site (background, titles, menus and footers). I also wanted to either set the logo of the site or just type some text and change the font and location of where it was displayed. All of that I wanted, plus an ability to see how it would look on a sample page so that I could see how the colors fit together.

Additionally, I really wanted to get into C# Express and .NET 2.0 to see what they had in them. So, I gave them a whirl and was really impressed. It actually restored a little bit of my faith in Microsoft, that they were actually giving away a program that you could write programs with and not pay $1000+. This, coupled with the boosted web browser control, increased my confidence that I could write something useful. Almost 2 years later, I finally finished something I could share with others.

However, before we get into the application, first let's go over a few of the basics.

Package

I am not sure if this is official DNN nomenclature, but I call a ZIP file that contains skins and containers that are to be uploaded to a DNN site a "package." The skins are in a ZIP file called skins.zip and the containers are in a ZIP file called containers.zip. Additionally, I use this concept to group some of the styles that are used globally. DNN uses a group of CSS classes on its own pages and some modules use them automatically as well. These classes are stored in the skin.css file. Since they are in one file, they are shared by all of the skins in this package.

Skins

A skin is a set of files that defines how a web page on your DNN site looks. You can assign a different skin to every different page or assign one for the whole site. You can define multiple skins per package. Skins can define just about any aspect of how the site looks. The files that can make up a skin include:

  • At least one ASPX or HTML file defining the layout of the page (Needed). This file will have areas defined where a user can place modules.
  • A Cascading Style Sheet (CSS) file called skin.css (Needed).
  • Images for displaying (Needed).
  • An XML file to merge with the HTML files to help expand properties (Optional).
  • Thumbnails of how the skin looks (Optional, but good to have).

All of these files are put into a single ZIP file with the name of the skin (e.g. MySkin.zip). All of this is done for you by the application! All you have to do is upload the skin via the interface.

Containers

Containers are the "window dressing" of each module in DNN. Each module can have a container or turn it off to stand on its own. The files that can make up a container include:

  • At least one ASPX or HTML file defining the layout of the container (Needed).
  • A Cascading Style Sheet (CSS) file called container.css (Needed).
  • Images for displaying (Needed).
  • Thumbnails of how the container looks (Optional).

Using the Application

Basic Skin Creator enables you to control the way that your site looks. You can create skins and containers, as well as edit some of the styles that DNN uses.

Main Screen

The application starts up with the window shown in the screenshot at the beginning of the article. A default skin and container are automatically created on startup. The screen is divided into two panes. The left pane contains two sections, the top section containing a tree with all of the items within the skin. The bottom portion of the left pane is a property grid that shows all of the editable attributes of the selected object. As you change the properties, the preview in the right-hand pane will change.

The right pane contains a preview of what the skin will look like in a browser. Keep in mind that this is not going to be exact. It is close, but it will not be exact. It also contains two tabs for the HTML and XML that the skin represents. This is more for debugging. I thought it might be useful for people who are trying to get into skinning more or wanted to know the format for each object. I will now highlight some of the more pertinent properties.

Layout Type

Currently, Basic Skin Creator supports two different layout types for skins:

  • Horizontal Menu Five Pane has a horizontal menu with Top, Left, Content, Right and Bottom panes.
  • Vertical Menu Two Pane has a vertical menu with Content and Right panes.

To change this property, click on the skin you wish to change the layout of and change the LayoutType property under the Appearance category.

Styles

Each of the sections is controlled by a style. The style tells how it will look. The following styles can be edited by Basic Skin Creator:

Package Skin Menu (under skin) Containers
  • Head
  • Normal
  • NormalBold
  • NormalDisabled
  • NormalRed
  • NormalTextbox
  • SkinObject
  • StandardButton
  • SubHead
  • SubSubHead
    • FooterStyle
    • LogoStyle
    • Menu Styles
    • PageStyle
    • TitleStyle
  • MenuArrowStyle
  • MenuContainerStyle
  • MenuIconStyle
  • MenuItemStyle
  • MenuRootArrowStyle
  • MenuSelectedItemStyle
  • MenuSubMenuItemStyle
    • TitleStyle
    • BodyStyle

    By setting any of the properties of these styles, you will change the way it looks in the web preview and, subsequently, the website.

    Menus

    Most of the styles are self-explanatory. Not so with the menus. The menus are one of the trickiest parts of the skin. Each element of the menu has its own CSS class that must be defined. A list of the menu classes that are editable by Basic Skin Creator and what they are for follows:

    • MenuArrowStyle: DNN places an arrow beside the selected page.
    • MenuContainerStyle: the backdrop of the menu.
    • MenuIconStyle: each menu can have an icon assigned to it; this class surrounds it.
    • MenuItemStyle: all of the non-selected menu items.
    • MenuRootArrowStyle: DNN places an arrow beside the root menu item of the selected page.
    • MenuSelectedItemStyle: the selected menu item.
    • MenuSubMenuItemStyle: menu items underneath the item.

    Note: Basic Skin Creator only works with the Solution Partners (SolPart) menu system. This is the default menu system for DotNetNuke.

    Logos

    Currently, the application supports four types of logos: Text, Image, DNN and None. These can be changed in the LogoType property. I hope to expand it to support both an image and text, but for now this is what we have. The Text and Image types are self-explanatory. You can select an image to be displayed as the Logo or write some text and align it as you like. DNN allows you to select a logo from the Admin -> Site Settings page. The DNN type will put a tag into the ASCX file that will get the image that you have selected from that page. None is also self-explanatory.

    DNN Controls

    DNN allows you to add what are called SkinObjects. SkinObjects allow you to add functionality to your site without adding a module and they can appear on every page. The application allows you to add or remove them if you would like. The SkinObjects that you can add/remove for skins are (in alphabetical order):

    • Breadcrumbs: shows the user where they are on the site.
    • Copyright: shows the copyright notice on the footer.
    • Date: shows today's date in the upper left-hand portion of the page.
    • Login: shows the register/login links in the upper right-hand portion of the page.
    • Privacy: shows the privacy link in the footer.
    • Search: shows the site search toolbox and link opposite the menu.
    • Terms: shows the terms link in the footer.

    The SkinObjects that you can add/remove for containers (in alphabetical order) are:

    • Help: shows the help icon on the right-hand side of the title.
    • Icon: shows the module's assigned icon (if assigned) in the left-hand side of the title.
    • Print: shows the print icon in right-hand side of the footer. This allows the user to print only the module on a page.
    • Syndicate: shows the XML icon in the right-hand side of the footer. This allows users to point an RSS reader to the module to receive any changes.
    • Visibility: shows the plus/minus sign in the right hand side of the title to allow the users to show/hide the module.

    Power Editor

    This application was originally inspired by making life easier on myself. So, why am I running all over the place making sure that all of the fonts are Verdana? Enter the Power Editor. You can make changes to the backcolor, font, font-bold, font-italic, font-size, font-name and forecolor to any style you wish. Or all of them. Just click on the Tools -> Power Editor menu item.

    Creating the Package for Upload

    Once you like the way everything looks in the skins and containers, you can create the package. The application supports exporting either ASCX files or HTML and the supporting XML file.

    You can create the package by clicking the Tools -> Create Package menu option. If you haven't created a package for this file before, the application will ask you for a location to save it to. You must use a *.zip extension and the name of the file will become the name of the skin. After it has completed, you can navigate to your DNN site. After you have logged in, go to either the Admin -> Skins or Host -> Skins page. Click Upload Skin on the module menu or at the bottom of the page. Browse to the skin you just created and select it. Once it has been selected, click the Save File link and it will upload it and process it. Both the skins and the containers will be processed.

    Now that the skin is up there, you can select it to be used as the default to the portal. To do that, select the Skins combo box and select the name of your skin (the name of the ZIP file). All of the skins that you created will appear. Select the Apply button to apply it to all of the portal pages and the admin pages as well. If you do not want it to affect the admin pages, then uncheck the Admin checkbox next to the Apply To label below the skins.

    Note that if you use only HTML files and then edit them, you must also put in the XML file to tell DNN how to process the files and get the menu colors right. The HTML files are processed by DNN into ASCX files.

    Hints

    Using Gradients

    All of the style types have Gradient as one of the background options. You must choose the BackgroundType of Gradient to activate this. You can specify a horizontal or vertical gradient. You can also specify an image size for the gradient that is different from the size of the style that you are working with. This enables you to have the starting color extend further down the page.

    Another thing to consider when using gradients is that when you use a gradient as a background for a container, the admin containers are generally double the height of regular modules. You will want to create containers for admin modules with the appropriate height.

    Colors

    Here are some good sites for choosing colors:

    Containers

    Something to consider when making containers is that a lot the modules do not specify how wide they are and they flow with how wide the widest line is. This can make for messy sites. You can have two modules that are in the same "pane," but have different widths. Alternatively, the center pane can take over the entire screen and make the side modules look squished. I would suggest making several containers at different widths and one with no width assigned. This allows the admin to enforce some uniformity on the site and have the flexibility of not needing one. The module will be at least as wide as the width you have specified, but no less.

    Credits

    The following articles/code were very helpful in assembling this application:

    License

    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Share

    About the Author

    R2B2
    Software Developer Computer Sciences Corporation
    United States United States
    No Biography provided

    Comments and Discussions

     
    QuestionError delete container's child Pinmembernoahdeen352-Dec-11 5:32 
    QuestionHow does a person run this progam PinmemberKevlar196417-Nov-11 12:17 
    AnswerRe: How does a person run this progam PinmemberKevlar196418-Nov-11 2:55 
    GeneralRe: How does a person run this progam PinmemberR2B221-Nov-11 4:46 
    GeneralRe: How does a person run this progam [modified] PinmemberKevlar196421-Nov-11 4:58 
    GeneralRe: How does a person run this progam PinmemberR2B221-Nov-11 5:51 
    AnswerRe: How does a person run this progam PinmemberKevlar196421-Nov-11 5:56 
    QuestionUsing basic skin creator PinmemberRoger Muller9-Oct-11 0:06 
    AnswerRe: Using basic skin creator PinmemberKevlar196418-Nov-11 2:55 
    GeneralMy vote of 5 Pinmemberdyrm17-Apr-11 4:40 
    GeneralCool stuff PinmemberUR-IT13-Jan-11 5:47 
    GeneralRe: Cool stuff PinmemberR2B225-Jan-11 10:05 
    GeneralMy vote of 5 PinmemberNzomigni28-Sep-10 3:55 
    GeneralNice work! PinmemberLane doug15-Apr-10 5:23 
    GeneralProblem with multiple font names and reloading a project. Pinmemberkelly12330-Oct-09 9:49 
    AnswerGood project PinmemberGanbaatar_J16-Sep-09 20:06 
    GeneralError when setting backgroundtype to image Pinmemberlange darm1-Apr-09 2:25 
    GeneralRe: Error when setting backgroundtype to image PinmemberPfotenhauer12-Apr-09 2:23 
    GeneralRe: Error when setting backgroundtype to image PinmemberR2B213-Apr-09 9:49 
    GeneralError when running a Basic Skin Creator PinmemberNirav Chikani10-Mar-09 2:17 
    GeneralRe: Error when running a Basic Skin Creator PinmemberR2B210-Mar-09 4:09 
    GeneralMany Thanks. Great Start Pinmemberzorob26-Feb-09 22:37 
    GeneralRe: Many Thanks. Great Start PinmemberR2B227-Feb-09 5:53 
    QuestionHow to make changes to the Packeged Skin PinmemberImranSyed8-Feb-09 20:42 
    QuestionHorizontal SubMenu Pinmemberanand6618-Jan-09 19:37 
    AnswerRe: Horizontal SubMenu PinmemberR2B219-Jan-09 3:42 
    QuestionRe: Horizontal SubMenu Pinmemberanand6619-Jan-09 3:55 
    GeneralImporting Existing Skins PinmemberJustin Porteous25-Jul-08 22:14 
    GeneralRe: Importing Existing Skins PinmemberR2B228-Jul-08 3:37 
    GeneralA Few errors Pinmemberbitfix8-Jul-08 10:51 
    GeneralRe: A Few errors PinmemberR2B28-Jul-08 11:36 
    GeneralErrors when loading XML files Pinmemberhuylyanh22-May-08 22:14 
    GeneralRe: Errors when loading XML files PinmemberR2B223-May-08 4:42 
    GeneralQuestion PinmemberPeterPanNL7-Feb-08 21:20 
    GeneralRe: Question PinmemberR2B221-Feb-08 6:40 
    GeneralPerfect project! PinmemberZeiman30-Jan-08 9:31 
    GeneralGreat Work! (minor build issue with ICSharpCode library) Pinmemberdkarantoniss12-Dec-07 21:49 
    GeneralRe: Great Work! (minor build issue with ICSharpCode library) PinmemberR2B213-Dec-07 5:46 
    GeneralRe: Great Work! (minor build issue with ICSharpCode library) Pinmemberdkarantoniss13-Dec-07 21:15 
    GeneralGeneral Question about DNN PinmemberX204012-Dec-07 21:18 
    GeneralRe: General Question about DNN PinmemberR2B213-Dec-07 4:24 
    GeneralGood Work !! Pinmemberimran_51711-Dec-07 2:42 
    GeneralExcellent Work! Pinmemberrainljr10-Dec-07 5:57 
    GeneralGreat work ! PinmemberPeterPanNL9-Dec-07 5:09 
    GeneralWow PinmemberTommi G8-Dec-07 5:35 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Mobile
    Web03 | 2.8.141022.2 | Last Updated 8 Dec 2007
    Article Copyright 2007 by R2B2
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid