Is there any way, like one does with WordPress, to create a header.php, theme-file.php and footer.php and then combine them using hooks? It seems crazy to me to still duplicate skin files especially when you need to make minor changes to the content of either a header or footer.
Many thanks
A skin is just an ascx control, so you can encapsulate parts of it just like you would any other WebForms view. You can put the header/footer content into their own ascx file, and then just include them in the skin. The only place you'll run into an issue with this is that I don't think DNN supports having panes in separate controls; everything else should be fair game.
You'll want to put them in a separate directory, so that they aren't seen as other skins by DNN.
Then, in the skins, include the controls by registering them in the header:
And include it via the control syntax:
The control won't automatically have access to any context from the skin, so if you need to use
SkinPath
orPortalId
or anything like that, you'll need to pass it through to the control manually. In the control, define a property to receive the value (using a<script runat="server">
section to write code [set theLanguage
attribute in the control to C# for this]):Then pass the value in the skin: