The skin is just an ascx control, so you can encapsulate parts of it just like other WebForms. You can put the contents of the header / footer in your own ascx file and then just include them in the skin. The only place you run into a problem is that I don't think DNN supports having panels in separate controls; everything else should be fair play.
You want to put them in a separate directory so that they are not perceived as other shells using DNN.
-MySkin --Controls ---Header.ascx ---Footer.ascx --Home.ascx --Home.doctype.xml --Interior.ascx --Interior.doctype.xml
Then include controls in the skins by registering them in the header:
<%@ Register TagPrefix="myskin" TagName="Header" Src="Controls/Header.ascx" %> <%@ Register TagPrefix="myskin" TagName="Footer" Src="Controls/Footer.ascx" %>
And enable it through control syntax:
<myskin:Header runat="server" /> .... <myskin:Footer runat="server" />
The control will not automatically access any context from the skin, so if you need to use SkinPath
or PortalId
or something like that, you need to pass it manually. In the control, define the property to get the value (using the <script runat="server">
section to write code [set the Language
attribute in the C # control for this attribute]):
<script runat="server"> public string SkinPath { get; set; } </script>
Then pass the value in the skin:
<myskin:Header runat="server" SkinPath="<%# SkinPath %>" />
source share