Smart Scripts:

The sample table was generated using the following HTML file:


    <H1>Sample Smart Table:</H1>

    The following table is generated by a script that looks to see what
    type of browser we are using:
    <p>

    <!--#exec cmd="./smart-table" -->

It calls the smart-table schell script, which is the following:


    #! /usr/local/bin/perl

    $browser = $ENV{'HTTP_USER_AGENT'};
    ($name,$version) = ($browser =~ m!^([^/]*)/(\d+(\.\d*)?)!);

    if ($name eq "Mozilla" && $version >= 1.1) {
      print "<BLOCKQUOTE><TABLE BORDER=2 CELLPADDING=10>\n",
	    "<TR><TD><I>x</I><TD>The horizontal axis</TR>\n",
	    "<TR><TD><I>y</I><TD>The vertical axis</TR>\n",
	    "</TABLE></BLOCKQUOTE>";
    } else {
      print "<PRE>",
	    "     +---+---------------------+\n",
	    "     | <I>x</I> | The horizontal axis |\n",
	    "     +---+---------------------+\n",
	    "     | <I>y</I> | The vertical axis   |\n",
	    "     +---+---------------------+\n",
	    "</PRE>\n";
    }

The .htaccess file contains the lines:

    Options Includes
    AddType text/x-server-parsed-html	page7-2.html
which tells the http server to look through the file for #exec comments to perform.


Last modified: Tue May 28 15:58:28 1996