Help

This script merges an HTML template file with an HTML content file. Use of this script can be helpful in maintaining a group of files, each having different content, with a common look and feel which may change over time.

How to call the script

This script is called with a URL such as
http://host/cgi-bin/script/~user/path?template?content
Question marks delimit the three arguments the script takes. First is the common part of the path to both the template file and the content file. Second is the part of the path unique to the template file, and third is the part of the path unique to the content file.

For example, if the URL for the template file is
http://host/~abc0/my/stuff/one/template.html
and the URL for the content file is
http://host/~abc0/my/stuff/two/content.html
the script should be called with the URL http://host/cgi-bin/script/~abc0/my/stuff?one/template.html?two/content.html

The template file

The template file is a standard HTML page, with placeholders where content is to be inserted. The placeholders take the form INSERTHERE=LABEL, where INSERTHERE= indicates that something should be inserted, and LABEL is what should be inserted.

Simple Example

Here is a simple example. Note that the file is a complete, valid HTML file.
    <!DOCTYPE HTML PUBLIC "-//W32/DTD HTML 3.2//EN">
    <HTML>
    <HEAD>
    <TITLE>
    INSERTHERE=TITLE
    </TITLE>
    <BASE HREF="http://$ENV{HTTP_HOST}/~abc0/my/stuff/index.html">
 
    <!-- The BASE statement is necessary if any relative links are
    in the template or content files. Without the BASE statement, those
    links would be relative to the CGI directory -->

    </HEAD>
    <BODY>
    <IMG SRC="images/logo.gif">
    INSERTHERE=CONTENT
    <P>
    <FONT SIZE=-1>
    INSERTHERE=MAINTAINER
    INSERTHERE=DATE
    </FONT>
    </BODY>
    </HTML>
    

More Realistic Example

Since the whole point of this script is to be able to maintain a look across multiple pages, more than likely, you'll have a fairly complex template.

Source

    <!DOCTYPE HTML PUBLIC "-//W32/DTD HTML 3.2//EN">
    <HTML>
    <HEAD>
    <TITLE>
    <!-- *** Insert title *** -->
    INSERTHERE=TITLE
    </TITLE>
    <BASE HREF="http://www.lehigh.edu/~ludoc/offcampus/index.html">
    </HEAD>
    <BODY BGCOLOR="#FFFFCC"
    TEXT="#000000" LINK="#008000" VLINK="#800000" ALINK="#FF0000">
    <TABLE>
    <TR>
    <TD>
    <IMG SRC="images/30x30.gif" ALT="">
    </TD>
    <TD>
    <A HREF="http://www.lehigh.edu">
    <IMG SRC="images/lu.gif" ALT="Lehigh University" BORDER="0"></A>
    </TD>
    </TR>
    </TABLE>
    <IMG SRC="images/rul_hori.gif" ALT="">
    <TABLE>
    <TR>
    <TD VALIGN=top>
    <BR>
    <IMG SRC="images/ppp.gif" ALIGN="top" BORDER="0" ALT=""> 
    </TD>
    <TD>
    <BR>
    <!-- *** Insert content *** -->
    INSERTHERE=CONTENT
    <P>
    <FONT SIZE=-1>
    <!-- *** Insert maintainer and date *** -->
    INSERTHERE=MAINTAINER
    INSERTHERE=DATE
    </FONT>
    <P>
    <HR>
    <FONT SIZE=-1>
    <A HREF="http://www.lehigh.edu/ir/">
    <IMG SRC="images/ir3.gif" ALIGN="top" BORDER="0" ALT="">
    Back to Information Resources</A>
    </FONT>
    </TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
    

Object

Here's what the template looks like if viewed directly (images will probably be broken, and I've removed HEAD elements):
Lehigh University


INSERTHERE=CONTENT

INSERTHERE=MAINTAINER INSERTHERE=DATE


Back to Information Resources

The content file

The content file contains HTML, and can be a standard HTML page. The only elements of the content file which really matter are the ones between START=LABEL and END=LABEL pairs. This pair of delimiters shows the beginning and the end of the block to be inserted at the place INSERTHERE=LABEL in the template file.

Sample Source

Note that anything in the content file which is not between START=LABEL and END=LABEL pairs is only there for convenience while viewing and editing the content file.
    <!DOCTYPE HTML PUBLIC "-//W32/DTD HTML 3.2//EN">
    <BODY>

    START=TITLE
    Lehigh Off-Campus Internet
    END=TITLE

    <P>

    START=CONTENT
    <H1>Lehigh Off-Campus Internet</H1>

    Welcome to Lehigh University Information Resources's home page for 
    Lehigh Off-Campus connectivity.
    <P>

    <HR>

    <H2>Connection Software</H2>

    Check out our <A HREF="matrix.html">software chart</A> to find out
    what software
    is available for making connections to Lehigh. Here, you can 
    find out what versions are current, get more information about the
    various packages, download most of the software, and find installation
    and troubleshooting guides.
    <P>

    END=CONTENT
    <P>

    START=MAINTAINER
    drb2@lehigh.edu
    END=MAINTAINER
    <P>

    START=DATE
    97November20
    END=DATE

    </BODY>
    </HTML>

    

Sample Object

START=TITLE Lehigh Off-Campus Internet END=TITLE

START=CONTENT

Lehigh Off-Campus Internet

Welcome to Lehigh University Information Resources's home page for Lehigh Off-Campus connectivity.


Connection Software

Check out our software chart to find out what software is available for making connections to Lehigh. Here, you can find out what versions are current, get more information about the various packages, download most of the software, and find installation and troubleshooting guides.

END=CONTENT

START=MAINTAINER drb2@lehigh.edu END=MAINTAINER

START=DATE 97November20 END=DATE