Will "the Mighty" Strohl

How to Clear Out Skins and Containers in DotNetNuke

There can be many times when you might want to clear out the skin and/or container value assignments for your DotNetNuke® website.  The most common example would be when you’re switching skins.  By clearing out the skin and containers, it can make it easier to re-assign the new skins and containers across your site.  (This of course depends on your specific site.)  This is quite easy to accomplish.

Default Skins and Containers

First, let’s review where the container and skin assignments are made.  This begins at the portal level.  For your portal, you can set the default skin and container to be used for all pages and containers in the Site Settings.

Site Settings > Basic Settings > Appearance

These values, once saved, live in the PortalSettings table in the DNN database.  You can find these values by using the following query.

   1: SELECT [PortalID],[SettingName],[SettingValue]
   2: FROM {databaseOwner}[{objectQualifier}PortalSettings] 
   3: WHERE [SettingName] IN (N'DefaultAdminContainer',N'DefaultAdminSkin',N'DefaultPortalContainer',N'DefaultPortalSkin') 
   4: AND [PortalID] = 0 
   5: ORDER BY [SettingName]

For each code sample in this blog, be sure to change the PortalID to reflect your own, if necessary.  Also, replace the tokens if you’re not using the SQL Module to run this code.

In order to clear our the default skin and container settings here, you simply nullify their values.  Here’s an example:

   1: UPDATE {databaseOwner}[{objectQualifier}PortalSettings] 
   2: SET [SettingValue] = NULL 
   3: WHERE [SettingName] IN (N'DefaultAdminContainer',N'DefaultAdminSkin',N'DefaultPortalContainer',N'DefaultPortalSkin') 
   4: AND [PortalID] = 0

Skin: Page Settings

Even though the skin and container is assigned in the Site Settings, it can be overridden in the Page Settings.  This value is saved to the Tabs table in the database.  The container value is used to be the default container for all new modules added to the current page, instead of the container specified in the Site Settings. 

Page Settings > Advanced Settings > Appearance

You can view this information by using the following query.

   1: SELECT [TabID],[PortalID],[TabName],[SkinSrc],[ContainerSrc] 
   2: FROM {databaseOwner}[{objectQualifier}Tabs]

In order to clear out the values, you would run the following query.

   1: UPDATE {databaseOwner}[{objectQualifier}Tabs]
   2: SET [SkinSrc] = NULL, [ContainerSrc] = NULL
   3: WHERE [PortalID] = 0

Container: Module Settings

Like the skins, the containers can also be overridden.  This time, we’re looking at the Module Settings.  This will override the default containers in the Site Settings and Page Settings.

Module Settings > Page Settings > Basic Settings

You can view the module container by using the following query.

   1: SELECT [TabModuleID],[TabID],[ModuleID],[ContainerSrc]
   2: FROM {databaseOwner}[{objectQualifier}TabModules]

Finally, in order to clear out the specified container values, you would use the following query.

   1: UPDATE {databaseOwner}[{objectQualifier}TabModules]
   2: SET [ContainerSrc] = NULL
   3: WHERE NOT [ContainerSrc] IS NULL

Summary

I really only discussed a single use case as far as the containers and skins are concerned.  Hopefully, you are able to see that these same queries can be changed in various ways to perform all kinds of administrative tasks.



blog comments powered by Disqus