I recently had the opportunity to introduce some new designers to the DotNetNuke web application framework. In the process of describing to them the benefits of our flexible skinning architecture, I suddenly realized a limitation to the current model which I had never considered before.
One of the main goals of the skinning architecture is that it allows the designer to work in a familiar environment with standard tools and concepts. The most basic artifact in the web design process is the HTML document itself, and it is at this fundamental level where I recognized a slight flaw. In the current model, the designer must create the HTML document - but as a final step before packaging it with the graphics, CSS, etc... they must manually strip out everything except for the content contained within the area of the document ( ie. remove the entire section and document declarations ).
Acknowledging the fact that this manual step adds an extra task to the skinning process which is clearly not intuitive, it also results in an HTML source document which does not reflect the visual representation created by the designer. This is because of the missing section where the associated CSS ( style sheets ) elements are declared. The result is an HTML skin file which is missing all of the "style" elements when it is viewed in isolation ( ie. it looks like a blank page with skin tokens like [MENU] and [LOGIN] scattered about ).
Now the ironic thing about this whole problem is that DotNetNuke already has a very robust parsing engine which is used to create a user control ( ASCX ) file from the HTML skin file. So why can't the parser simply extract the content from the section automatically? If this were possible then the designer would not need to strip anything from their HTML document and the design could be preserved in its original form. Well, of course this is possible! It was just a matter of coming up with the right Regular Expression. Scott Willhite to the rescue ( Scott is the man responsible for the powerful and elegant skin parsing engine which leverages RegExp extensively )...
So I passed my requirements to Scott and he sent back the following expression:
<\s*body[^>]*>(?<skin>.*)<\s*/\s*body\s*>
( which looks like Greek to me )
Anyways, I added a few lines of code to the SkinFileProcessor and voila - DotNetNuke can now support HTML skin files as standard HTML documents ( including a section with style sheet references ). Look forward to seeing this feature in DNN 3.3 / 4.1.
Oh yeah... thanks again to Scott "Mr. RegExp" Willhite...