Skin objects are a great way to integrate functionality in your DotNetNuke portal site wide. This can be helpful if you would like to provide a custom search for your modules, etc. In a recent e-commerce project we working on we needed to provide a search skin object to facilitate the searching of products. Sure, you can implement ISearchable in your module and then use the DotNetNuke core search. However, sometimes project requirements dictate additional functionality needs not provided by the DNN core search. DotNetNuke skin objects inherit from a different base class than DotNetNuke modules do. Modules inherit from the PortalModuleBase while skin objects inherit from SkinObjectBase. One issue that you may run into when creating a skin object is the need to get the PortalId of the current portal. There are several reasons you may need PortalId such as locating module instances, etc. The SkinObjectBase does not expose PortalId directly as a public property like PortalModuleBase, however there is a way to get this value. In order to access this value (and other useful ones) take a look at PortalSettings.ActiveTab. From this you can get both PortalId and TabId which are needed quite often when using any of the DotNetNuke core methods.
Posted in:
DotNetNuke Tips & Tricks on Monday, November 03, 2008 11:39 AM by Scott Schecter