That’s an interesting thought as well. We almost need some sort of sub-templates.
I’ve been converting a basic HTML layout to templates, chunks, etc for a site I’m working on, and this is what is happening.
I want to repeat as little code as possible, but I also want to make things easy to manage. I make a chunk for my header and menus. I make a snippet for my footer since I have PHP in it. Within the main part of the page, I have a right and a left div, so I make a chunk/snippet for each. I will use this exact layout for the entire site, and all that changes is the content of the left and right divs.
Here’s an example of my code that every page needs. For right now, I just left the right div as a chunk. The main content goes in my left div, where I have placed a comment.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Title</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<!--[if IE]>
<style type="text/css">
.clear {
display: inline-block;
}
.clear {
zoom: 1;
display: block;
}
</style>
<![endif]-->
<!--[if lt IE 7]>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styleIE6.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if lt IE 8]>
<script src="IE8.js" type="text/javascript"></script>
<![endif]-->
<!--<script type="text/javascript" src="jquery.js"></script>-->
</head>
<body>
{{Header}}
{{Navigation}}
<div id="canvas">
{{Subnavigation}}
<div id="main" class="clear">
<div id="left">
<div id="content">
//***** Content of every page goes here
</div>
</div>
{{Right}}
</div>
{{Summary}}
</div>
[[Footer]]
</body>
</html>
Even though the important parts of the code are stored in chunks so I can easily change them on all pages, I still have quite a bit of markup that I would need to put on every page. So then I make a chunk called Start and a chunk called End that contain the markup before the comment and the content after the comment respectively. Then all I need for each template is this:
{{Start}}
//template specific code here
{{End}}
However, I think in a very systematic way, and I like my code to be nested in different levels in a way that makes sense, so I don’t like having "all code before the changing content" as a chunk, then the content specific to the template, and then "all code after the changing content".
I guess what I’m thinking is this. It’d be really nice if I could specify an overall template that included my XHTML DOCTYPE, HTML head info, etc. This overall template would contented a nested reference to a subtemplate that covers everything inside the body tags. This body subtemplate would include a nested reference to a content specific template that would change based on the type of document being used, as specified by the user upon creating the document. Does this make sense?
Right now, we are limited to one level of templates that the user chooses. I’d like to see a way to nest templates, so to speak, and let the user choose the child template. Right now, it’s like the user chooses the "parent" template, and the template itself is forced to sort out all of the details. I’d like it where the child template called for a specific "parent" template to be loaded. If anybody has any experience with ASP.NET (it’s been a long time for me, too

), I believe it worked the same way. This way, it would be very easy to change the entire layout of the page (if desired) for different types of documents (based on user choice with the template option), but every template wouldn’t have to include all the HTML for the page or use chunks to do the same.
I’m not sure if that made sense, but it’s just an idea.