#include <infodrom.style>
#include <projects.style>

<projectpg project="Lightweight CGI Library" maxcontrib=5>

<h3>The CGI Variable library</h3>

  This library intends to help people maintaining web sites with
  included CGI-support, e.g. as connection to a database or something
  else. <p>

  The library helps you to divide between design and content.  Thus
  the person who works on web design does not need to know about
  programming and the person who does the actual cgi programming does
  not need to know anything about HTML and web design. <p>

  The past has shown that often these people only want or can work on
  one of the two issues but not on both.  However, you'll need to
  understand that design and content are divided and the person
  writing the CGI program does not need (or does now want) to munch
  with HTML. <p>

<h3>Supported languages</h3>

  Currently only Perl is supported.  Support for C is urgently
  required, though. <p>

<h3>Installation</h3>

  Place the file cgivar.pl in /usr/local/lib/site_perl/ or whereever
  your Perl installation expects additional .pl files. <p>

<h3>Usage</h3>

  To add cgivar support to your programm, simply add the following
  line at the top of it: <p>

<pre>
    require 'cgivar.pl';		# HTML-Parser
</pre>
  

  You will have to open the template file first and pass an arbitrary
  amount of (name,value) pairs to the display routine.  The template
  is loaded with: <p>

<pre>
    &cgivar_load ($template);
</pre>

  Where $template refers to the full path to the template.  You may
  call your template foo.html in order to let Editors (preferred:
  Emacs) recognize it as HTML file.  This will make the library
  evaluate the template and store it in its internal data structures.
  You may load more than one template at the same time. <p>

  If that's done you may now fill a hash with (name,value) pairs such
  as: <p>

<pre>
    $cgivar{'name'} = 'Martin Schulze';
    $cgivar{'email'} = 'joey@linux.de';
</pre>

  Then let the library display the file by issuing the following
  command: <p>

<pre>
    print &cgivar_eval_head ($template,\%cgivar);
</pre>

  As you can imagine the file is divided in more than just one part.
  Indeed currently four parts are supported: <p>

<dl>
<dt> HEAD
<dd> Head of a template.

<dt> FOOT
<dd> Foot of a template.

<dt> ENTRY
<dd> Middle part of a template, may be repeated.

<dt> ALTERNATE
<dd> Alternate middle part, e.g. if no entries were found.
</dl>

  Dividing up a template gives you a chance to provide variable HTML
  code if this is required, e.g. when browsing through entries of a
  database.  In that case, you will call cgivar_eval_entry() as often
  as you need. <p>

<h3>The template</h3>

  The template is - you guessed it - HTML code basically.  However,
  some variables need to be present to be replaced by their actual
  values.  These are denoted by &lt;cgivar name&gt;. <p>

  A simple example would be: <p>

<pre>
    &lt;html&gt;
    &lt;head&gt;&lt;title&gt;&lt;cgivar title&gt;&lt;/title&gt;&lt;/head&gt;
    &lt;body&gt;
    &lt;h1&gt;&lt;cgivar title&gt;&lt;/h1&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</pre>

  When using different parts of a template you'll divide it up as
  follows: <p>

<pre>
    [head]
    &lt;!-- Begin Entry --&gt;
    [entry]
    &lt;!-- Alternate Entry --&gt;
    [alternate]
    &lt;!-- End Entry --&gt;
    [foot]
</pre>

<h3>Download</h3>

<a href="download/cgivar.pl">here</a> <p>

</projectpg>

# Local variables:
# mode: html
# mode: auto-fill
# end:
