WebMerge uses templates to generate Web pages. A template is simply a standard HTML page with special placeholder tags. WebMerge replaces those tags with the corresponding data from your source file.
You can design your template pages using any HTML authoring program, including Macromedia Dreamweaver, Adobe GoLive, BBEdit, or even Word Pad.
If you need to generate pages instantly and don't need a customized layout, WebMerge also provides an option for generating simple templates automatically for you.
WebMerge can generate detail pages, or index pages, or both. A detail page uses data from a single record, with a new page generated for each record. An index pages shows data from multiple records on a single page.
Here's a simple example of a template using the WM-Field tag to place the contents of a field into a page:
<html> <body> Hello world. My name is [WM-Field: UserName] </body> </html>
In this example, UserName is the name of a field in the database that was exported to the source file. If you had the value "Aram" as the data in that field, when WebMerge generates the page for that record the result would look like this:
Hello World. My name is Aram.
When generating detail pages, WebMerge makes one copy of your detail template, and for each record in your source file it replicates a specified portion of your index template to provide a link to your detail page.
For index pages, WebMerge will replicate a portion of your template for each record in your source file. You specify the record portion of your index template using the WM-Record tag.
Any HTML between the [WM-Record] and [/WM-Record] tags will be replicated once for each record. The data within the WM-Record tags can contain other tags, such as WM-Field, so you can pretty much make any layout you want.
Here's an example of how it works. If your template contains this:
<body> <table border="0" width="400"> [WM-Record] <tr> <td>[WM-Field: Name]</td> <td>[WM-Field: City]</td> <td>[WM-Field: State]</td> </tr> [/WM-Record] </table> </body>
...then the HTML WebMerge generates will look something like this:
<body> <table border="0" width="400"> <tr> <td>Richard Gaskin</td> <td>Los Angeles</td> <td>CA</td></tr> <tr><td>Joe Schmoe</td> <td>Faketown</td> <td>PA</td></tr> <tr> <td>Jane Doe</td> <td>Anytown</td> <td>MO</td> </tr> </table> </body>
If your index template contains WebMerge tags before the [WM-Record] tag or after the [/WM-Record] tag, WebMerge will still process those tags, using the data from the first record of your source file. If you're making multiple index pages, tags outside of the WM-Record tags are processed using the first record in the range for that page.
FileMaker and some other database tools modify multi-word field names when they generate Merge or other export file formats. For example, if your database contains a field named "First Name", in the exported Merge file it will be listed as "First_Name". When adding tags to your template HTML file, please keep this in mind and use underscores wherever spaces might otherwise appear in field names. So instead of writing your tag like this:
[WM-Field: First Name]
you should write:
In addition to the WM-Field and WM-Record tags, WebMerge provides more than a dozen other tags, such the WM-Include tag which copies the contents of another HTML file into your page, and the WM-LinkIndex tag that automatically creates a link on a detail page to its corresponding index page. Some WebMerge tags also support optional attributes to determine how WebMerge will handle them.
See Using Tags in Templates for a list of all tags currently supported in WebMerge, with links to detailed notes on their usage.