replacehtml.gif (15991 bytes)

Why replaceHTML?

When you create a Web site, you nearly always have some type of common areas, usually the top, side and bottom. Even if you are only creating ten such pages, one change to these common areas can become quite a pain, no matter how small. replaceHTML is made for Web designers that hand-code their pages or use a GUI HTML editor and have hand-coded things (Javascript, etc.).

You might call me lazy (crazy?), but I love to use MS FrontPage to do as much work as I can. It's fast, easy, and creates reasonable code. However, it's border feature is just too rigid for my needs. I found an interesting utility that sort of solved the problem, but it required separate places for old files and replaced files. With MS FrontPage, this required me to edit the site in two different "Web areas". What I really wanted to do was to be able to totally replace specific areas of code at will, which is exactly what replaceHTML does!

Note: I haven't tried it, but replaceHTML should work with any GUI HTML editor.

replaceHTML will replace entire blocks of HTML code. Anything between the open and close tags is replaced with a specified file. You can even have multiple sets of tags in the same HTML file. Browsers ignore the replaceHTML tags, so they can remain in the code, allowing you to update the code whenever a change occurs.

How to Set up

Here is a snippet of HTML code to show you how to use it:

<!--replaceHTML=file-->whatever HTML code exists<!--/replaceHTML-->


<replaceHTML=file>whatever HTML code exists</replaceHTML>

*Note: Some GUI editors have problems with second version (not MSFP).

"whatever HTML code exists" will be replaced by the file


• Do not split either the opening or closing tags between lines. For example, do not do this:

<img src="images/cool.pic"><!--replaceHTML=
borderfil.txt-->This is a nice picture

• Do not enclose the filename in quotes, even if there are spaces in the filename.
• If you just define a file (i.e., no path), it will look in the same folder as the HTML file.
• You can define full drive:path (e.g., c:\data\replacement\addthis.txt) if you want.
• Relative paths (e.g., ..\jacqueline\november.txt) can be used too. (If you don't know ..\ brings you up one directory. This is standard HTML stuff :-)
• You can only process HTML files in same folder at any one time.
• You can have multiple sets of replaceHTML tags in the same HTML file, but they cannot be embedded. That is, a set of replaceHTML tags cannot be inside another set.

MS FrontPage Users Read!!!!!!

Their is a little anomaly when using replaceHTML with MS FrontPage you need to be aware of. If you are replacing a table that is inside the cell of another table, you need to add a little code. This situation happens all of the time when you are placing a menu table inside a larger page layout table.

Here's where you want the tag:

replacehtml_fp1.gif (4047 bytes)

Once you save or switch from FrontPage's HTML view, it moves the tag:

replacehtml_fp2.gif (4153 bytes)

The solution (for whatever reason!) is to add a <p> after the closing </table> tag, but before the </replacehtml>, like so:

replacehtml_fp3.gif (4028 bytes)

Remember that the <p> must be part of the replacement file! (At the very end)

You only need to do this when the above situation exists. Add the <p> in other situations may cause problems!

Why FP does this is beyond me since it doesn't even know what the </replacehtml> tag does. It actually will do this if you place anything between <>, so at least it isn't a plot against me ;-) This is the only time I noticed this happening, but I suppose there could be other instances.

General Warning for All GUI Editors

Make sure the the GUI editor does not move the replaceHTML tags around. You may have to play with their placement to get things to work as expected.

Processing will be aborted for an HTML file if:

• the replacement file is not found
• unbalanced tags exist (e.g., open without a close tag)
• a backup or replacement file cannot be created
• you click Abort ;-)

Note that processing for other selected files will continue, unless you have clicked Abort.

How to Use

1. Click the Select path... button (or use menu) and select target path. If you only want to process HTML files check that option on the dialog.
2. Click OK and the files will be placed in the Available Files list.
3. Select the files you want to process. Hold Shift key to select range and/or Ctrl key for non-contiguous multi-selection.
4. Click the Process Selected files button (or use menu) to process all selected files or double-click a file in the Selected files list to process just one. Click the Abort button to interrupt the processing. (Be patient with this ;-)

The Processed file window will shows the processed file followed by the number of replacements made.

The Path field shows the path for the selected folder. This is for information only--the field is not editable.

replaceHTML has no effect on files that do not have the replacement tags in them.

Files Menu

In the Files menu, there is a Recent Folders option. This will bring up a list of the last 20 unique folders (subdirectories) used to process files (i.e., not just selected).

Options Menu

Select Backup originals to create backup files (i.e., before replacement) using .bak file extension. This setting is saved when you exit.

This option may clutter your directory, but it's better to be safe than sorry, particularly if you are using a GUI HTML editor--you just never know what it may do! (See the FrontPage warning above.)

If Error msg off is active, processing errors are not displayed, but written to a file called Error.log in the replaceHTML directory. It is probably best to keep this off, since you will usually want to stop processing if errors occur.


replaceHTML requires Windows 95, 98, or NT4.


replaceHTML (beginning with version 1.1) is freeware! However, I'd love to receive an e-mail ( from you to hear what you think.

Copyright 1999 Douglas J. Nakakihara
All rights reserved

An HTML editing tool that will replace blocks of code with a specified file. replaceHTML, replace, HTML, code, dougworld,, utility, Web, editing, editor, FrontPage, Designers, GUI, javascript