Will "the Mighty" Strohl

Setting a Default Container for Skin Panes in DotNetNuke

Did you know that you can set a default container for a skin pane?  Meaning, when someone adds a module to the page, it will automatically pickup the specified container even the Page or Site Settings say otherwise.

What does that mean to you?  Think of any of the times that you might have built a skin with panes that either have specific widths or color scheme that expects only a container that matches those restrictions.  Now, do you remember having to train the users/admins on which panes that have to be used and why?  How about support calls to remind them why the skin design broke, because they put one of the other containers in the wrong pane?

All that goes by the way side when you set a default container for each pane.  When someone adds a module to the pane, it automatically gets assigned the correct container.

First of all, you are probably already doing something like this in your existing HTML or ASCX skins:

<div id="ContentPane" class="somecssclass" runat="server"></div>

Implementing default containers is surprisingly simple.  All we need to do is add a few more attributes to the previous HTML code. 

For our example, lets consider a scenario.  Let's pretend that we have a content pane that only intends to have containers that are 500 pixels wide.  Let's assume that we have a container named "Title_500pxWide.ascx" to accomplish this.  Once you do, your new HTML snippet will look something like this:

<div id="ContentPane" class="somecssclass" runat="server" ContainerType="L" ContainerName="SkinName" ContainerSrc="Title_500pxWide.ascx"></div>

It is important to know what these new attributes are and what they do.  Here they are listed for you:

  • ContainerType - (L or G) L is for skins installed in the Admin Menu, and G is for skins installed in the Host Menu.
  • ContainerName - This is the name of the skin, and also the name of the zip file used to install the skin.
  • ContainerSrc - This is the name of the container file, once it is parsed into a Server Control.

It is important to note that if you specify your containers using L (for Admin), and the Admin installs the skin package in the Host Menu, the specified container will not be found.  In turn, it will not be shown, and whatever is set in the Admin or Page settings will be used.

Also, if you specify a different container in the Module Settings, that will be the container that is used.  The default in the skin will be overridden, but only for that module.

That's it!  This example will work for any pane, on any skin.  Even DotNetNuke 5 skins.  Give it a try!  You'll never look back.

Technorati Tags: , , , ,



blog comments powered by Disqus