Delane Hewett
Visual InterDev Program Management, Microsoft Corporation
March 1997
Microsoft® Visual InterDev™ templates give you models for creating various sorts of Web pages. Templates are Hypertext Markup Language (HTML) or Active Server Page (ASP) files constructed so that you can put specific information into a predetermined structure.
A Visual InterDev template can include HTML layouts, HTML text, and server and/or client side scripting. In addition, you can customize the template by imbedding placeholders (called replaceable parameters or RPs) in it. When you run the Template wizard, these RPs will be replaced with HTML and/or scripting.
A template can be a single file or a group of up to three associated files. These files can be HTML, an ASP, and/or an ALX (Active Layout). If multiple files are used for a template, they must all have the same name, but will have different file extensions (for example, .htm, .asp, .alx). For example, the following files would belong to a single template named "Home": Home.htm, Home.asp, Home.alx.
The wizard will display the name only once in the Templates list, but will act on each of the files with the same name. Only one will be opened in the editor at the completion of the wizard, based on the following table.
Combination | Open this file |
ASP, ALX, HTM | ALX |
ASP, HTM | HTM |
HTM, ALX | ALX |
ASP, ALX | ALX |
HTM | HTM |
ASP | ASP |
ALX | ALX* |
*A single ALX file may be a template but usually requires an associated HTM file.
Note The Template Wizard assumes that the HTML or ASP files have the correct object tags in them pointing to the ALX file.
All will be parsed for replaceable parameters and added to the project.
There are two primary scenarios for multiple-file templates. In the first scenario, you combine an HTM file with an Active Layout (ALX) file. In order to use active layout files in web sites, you need an HTM file to store the W3C "Object" tag (pointing to the ALX file) and you need an ALX file to store the ActiveX™ controls and their 2-D placement. Thus, you need two files, HTM and ALX, for your template.
In the second scenario, you have an HTM file containing an HTML form that you would like processed by an ASP file. Here you would also need two files, this time an HTM and an ASP file.
An RP is a placeholder in the template that the Template wizard recognizes as something it needs to replace. As the Template wizard runs, it identifies each RP and, depending on the RP, either prompts the user or takes actions itself. An RP is surrounded by the following delimiters: "<%#
" and "#%>
". For example, a replaceable parameter might look like this:
<%#This is a Replaceable Parameter#%>
RPs are case insensitive. The following RPs are automatically recognized by the Template wizard.
<%#THEMENAME#%>
<%#DATACONNECTION#%>
<%#FILENAMEWITHOUTEXTENSION#%>
<%#FILENAMEWITHEXTENSION#%>
The replaceable parameter <%#THEMENAME#%>
can be placed anywhere in an HTM or ASP template file. When the Template wizard encounters this RP, it prompts you to select a theme that will be applied to your template. For more information about themes, see "Creating Your Own Visual InterDev Themes." The following represents an HTML document fragment before and after processing by the wizard. In this example, the user chose a theme named "swamp."
Before: <A IMG="./images/<%#THEMENAME#%>/rules/rule1.gif"></A>
After: <A IMG="./images/swamp/rules/rule1.gif"></A>
No matter how many times the ThemeName replaceable parameter is found within the template, you will be prompted to choose a theme only once.
The replaceable parameter <%#DATACONNECTION#%>
can be placed in any ASP file. This RP is used by the wizard to allow selection of an existing project Data Connection. The user is prompted with a list of existing Data Connections to choose from.
The replaceable parameters <%#FILENAMEWITHEXTENSION#%>
and <%#FILENAMEWITHOUTEXTENSION#%>
are used to insert the template’s file name into the document created by the template. You can specify the file name with or without the file extension.
If an RP is not known to the Template wizard, the wizard assumes that it is a user-defined RP and prompts you for the substitution string. The following example illustrates the use of a user-defined RP intended to collect the user’s e-mail alias:
<H5>Send mail to <A HREF="MAILTO:<%#Enter your Email alias here:#%>"> <%# Enter your Email alias here:#%></A></H5>
If the user types "someone@microsoft.com" in the prompt, the file would contain the following text:
<H5>Send mail to <A HREF="MAILTO:someone@microsoft.com">someone@microsoft.com</A></H5>
Note The maximum text length is 100 characters.
If you chose the Typical Setup option during installation, templates are stored in a directory called "Templates" under the install directory for Visual InterDev. To change the default directory:
[HKEY_CURRENT_USER\\Software\Microsoft\DevStudio\5.0\Directories]
[HKEY_CURRENT_USER\\Software\Microsoft\DevStudio\5.0\Directories]
"TemplateDir" = "\\Server\Share\MyTemplates"
Static files, such as inline images, referenced in a template through relative URLs (for example, /images/arrows/arrow1.gif) will be imported into the project maintaining the path to their relative locations. If the static file is not contained in a directory under the template in the file system, then the file will be copied to the Images directory of the project. The link in the template file will be modified to reference the static file in its new relative position. Static files referenced through absolute URLs (for example, http://myserver/myshare/images/arrow1.gif) are not added to the project.