HOW TO: Create a DotNetNuke® Skin Object

Disclaimer: This blog entry assumes that you have prior experience and knowledge creating and installing modules.

Skin Objects in DotNetNuke® offer functionality that the skin designer can plan for, but not need to know how to create. But what is a skin object? It is a .Net User Control that offers a functionality that you want offered to the skin, but not as a module.

There are plenty of reasons why you would want to create a skin object over a module. For example, anyone with administrator or edit permissions can alter the functionality of that module. Examples of a skin object are: Login, Search, Menu, Breadcrumb, and more. You might notice a common trend among all of those examples. None of them need to be managed after the skin is complete. So why allow someone with edit permissions to tinker with it once it is on the site?

No matter what you skin object is supposed to do, remember one thing. You need to expose public properties that allow for settings and CSS to be defined by the designer in the skin.xml.

Essentially, there are usually only four significant differences between a skin object and a module. The first difference is that you cannot automatically generate an installation package for a skin object like you can with a module.

The second difference is that the Skin Object does not need the Edit and Setting controls that you normally include in the development of a module. There is no interface available to manage skin objects, and there shouldn't be. That would completely defeat the purpose of skin objects.

Coming in as the third difference is the inherited class. While you can still inherit from the PortalModuleBase class, you should be inheriting from the DotNetNuke.UI.Skins.SkinObjectBase class instead.

The fourth and final difference, and this is the most important one, is that the manifest file has two distinct differences. If your manifest file is not correctly defined, the skin object will not install as a skin object, but rather install as a module or not install at all.

This probably doesn't look a whole lot different at first glance. Take a look at the first node, at the Type attribute. Notice that instead of the value Module, it now is the value SkinObject. That is the most important difference.

The other difference is that you will see much less code in the manifest file. This is because we do not need as much definition for the skin object files for a couple of reasons. First, there are not as many files to define. Second, the definition of the remaining files do not require the same treatment, as there are fewer nodes needed to tell DotNetNuke® how to display the user controls. There is only one way.

That's it! I bet you thought it was MUCH more complicated than that. Huh?