Terryburg’s Tales of Things You Might Not Know

Things you might not know about Dreamweaver nested templates

Things you might not know about Dreamweaver nested templates

Yeah yeah, Dreamweaver. But it’s good for some things, like static sites which, believe it or not, some clients still want.

So we used to do these with a number of individual templates that included everything from opening HTML tag on down to implement various sections of the site. If you decided you wanted to change common element in one of them, like the nav bar or something, you had to remember to change it exactly the same in all. What a pain that was. I didn’t want to go through it again.

As it turns out Dreamweaver has anticipated this and provides for sub-templates, where you start out with a main template for your whole site, one that has all those common elements you might want to change all at once, and then you create sub-templates from that where only your sub-section markup goes. Create a new document from that main template, and save it as a template. Voila sub-template. And then at some point in the future if you need to change that nav bar, you change it in just the main parent template, and the changes cascade down through all the child templates and the pages created from them as well. Groovy.

I’m just doing this now, first time, so this blog post is my ongoing notes to my future self, who will otherwise forget all this by the next time the need arises but I know will not want to spend all that time Googling again.

My plan for use of sub-templates was to define a general “content” editable area in the main template, and then use that to further define more specific layouts for sub-sections, and more specific editable areas inside those.

So, issue #1, template parameters from the parent template would not be available to the pages created from the sub-template. I needed those (like ID’s for the body tag). After a lot of searching and messing around I finally found out that you can highlight that little sumgun (which is now an InstanceParam) in your sub-template and Modify -> Template Properties, and there will be a little checkbox that says “Allow nested templates to control this”. If you check it and save your template it adds a ‘passthrough=”true”‘ parameter to your InstanceParam line, all of a sudden you can change that parameter again in the pages created from the sub-template. Not a perfect solution, as you now must remember to do that to all of your sub-templates. The key to remember is do it in the sub-template, not the main parent, where the programmer in me says it should be done. But better than nothing.

Issue #2, I mark up that content area in my sub-template with specific layout for that section but then if I create a new page from it the whole thing is still editable. I don’t want that. I want a new template with new editable areas, and that main template’s big fat open content region no longer changeable by the person filling in content. This one, it turns out, is pretty simple – just create a new editable region or regions inside that main editable content area inherited from the master, and save, then create a new page from your sub-template and poof that big main content area is closed, no longer editable. Yeah, Dreamweaver gives you a scary message.

More later if I run into more Things Of Mild Interest regarding Dreamweaver templates.