The conception, birth, and first steps of an application named Charlie

Subscribe: Atom or RSS

The Raw Approach is Extensible

by Alister Jones (SomeNewKid)

A short while ago I introduced the story of three website owners: Tom, Michelle, and Joshua. Each owner wanted a different level of control over the look and feel of his or her website. Tom accepted a starting template provided by the Wizard. Michelle also accepted a starting template, but then used the Control Panel to customise the colours of the template. Joshua too accepted a starting template, but then updated the declarative templating system to customise all aspects of his website’s design.

It should be obvious that it is the Wizard that provides the default declarative templates. After the Wizard has been used to select the starting template, that starting template can be customised declaratively or through a graphical user interface. This was described in the previous weblog entry.

But how does the Control Panel fit into this templating system? Here is how the Colours may be defined through the Control Panel.

How then do we get these colour definitions into the declarative templating, which looks as follows?

<html>
   <head>
       <insert:Style name="Daylight" />
   </head>
   <body>
       <insert:Snippet name="Header" />
       <h1><this:Title /></h1>
       <this:Content />
       <insert:Text name="Disclaimer" />
   </body>
</html>

The first <insert> element is for a Style. The style will reside in a Styles folder, and its editor will look something like this:

What should be obvious is that the Style editor uses the same declarative approach to “inserting” external elements. To drive the point home, here is how our Snippet editor might look:

And where do these inserted Text elements come from? Well, just as the Control Panel provides the Colors icon, it would also provide a Text Resources icon. Here is how the Text Resources screen might look:

To summarize then, each <insert> element will “pull” information either from the Control Panel or from a special folder (such as Styles). Moreover, the inserted Snippet of HTML can do its own “pull” of information. So one Snippet can pull in another Snippet, which in turn pulls in a Text Resource, which in turn pulls in a Money Resource, and so on.

What this means is that for a website owner like Joshua who wants extensive control over how the website is designed, only a single declarative trick needs to be learned. That trick can then be applied over and over again. For a website owner like Michelle who wants limited control over the look of the website, only the Control Panel needs to be used—no need to learn the declarative trick. For a website owner like Tom who couldn’t care less about the look of the website, only the Wizard ever needs to be used to select a starting template.

At the end of the weblog entry titled A Dirty Sheet of Paper, I said that I took a pen and paper and said to myself, “Forget that you’re using ASP.NET. If you could create a user interface from scratch that allows a website owner to update both content and design, how would you do it?” The preceding weblog entries describe the templating system that I consider to be the most simple and the most flexible, with no consideration at all given to ASP.NET concepts such as master pages, themes, or skins.

After putting ASP.NET to one side and coming up with a theoretical templating system, it is time to bring ASP.NET back into play and come up with a working implementation of this templating system.

by Alister Jones | Next up: Recursion is not a Dirty Word

0 comments

----