Template construction has been available in Dreamweaver for some time, but MX offers some added power, thanks to its JavaScript-like programming interface. Using script-like code
<!– TemplateBeginEditable name=”doctitle” –>

developers can create custom, user-maintainable Web templates. Templates can be nested, and they can include if…then logic to display certain aspects of the page only in certain situations.

Free for the taking
We’ve put together a dynamic template you can download for free. Although the template is basic, it will help you get the ball rolling to whip up a corporate intranet and allow you to keep the look-and-feel and select functionality locked down if you have many developers touching pages.

A quick overview of what you will find
The first piece of template code is <!– TemplateBeginEditable name=”head” –><!– TemplateEndEditable –>. If the designer or developer needs to add any code to the <HEAD> section of the HTML document, just this one portion will need to be accessed. Another benefit of templates, particularly in sites with dynamic content and back-end programming, is that the ColdFusion, ASP, or PHP code, or whatever other language is being used for the code, is not at risk of being overwritten accidentally or changed.

Our template has many dynamic pieces to it, which will enable you to customize it as needed. If you don’t want something to be dynamic, you can remove the parameter and hard code. Our template allows you to control the background color of the main site, as well as the navigation. You can also control aspects such as the size and color of the section heading, as shown in Listing A.

Template parameters can be text, numbers, or Booleans. When using a parameter as a variable, you can display its value by referencing it as @@(ParameterName)@@, as shown in this code snippet below:
<IMG SRC=”@@(IMG_Logo_Path)@@” BORDER=”0″>

Parameters can be used as logic switches too. Listing B illustrates how a parameter value determines whether the footer is displayed.

Intranet users need a way to get from section to section. This template offers a standard left-side navigation. You can add to it as more sections are offered. Editable sections can be included within repeated sections, so, for example, you can add more table rows. Listing C shows how repeating sections can be added to and subtracted from by the user, without affecting the surrounding page.

Not all template code is aimed at what a user can input into the new file. Based on parameters, template code can control graphics, page layout—essentially anything. The following code snippet illustrates this concept by controlling what uneditable code is displayed:
<IMG SRC=”@@(IMG_Logo_Path)@@” BORDER=”0″>

Download the template
Jump-start your intranet development efforts with this free MX template and support code. If you would like to submit a template for Builder.com, contact the editors.