Lightweight CGI LibraryThe CGI Variable libraryThis library intends to help people maintaining web sites with included CGI-support, e.g. as connection to a database or something else.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. 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.
Supported languagesCurrently only Perl is supported. Support for C is urgently required, though.
InstallationPlace the file cgivar.pl in /usr/local/lib/site_perl/ or whereever your Perl installation expects additional .pl files.
UsageTo add cgivar support to your programm, simply add the following line at the top of it:
require 'cgivar.pl'; # HTML-Parser
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:
&cgivar_load ($template);
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. If that's done you may now fill a hash with (name,value) pairs such as:
$cgivar{'name'} = 'Martin Schulze';
$cgivar{'email'} = 'joey@linux.de';
Then let the library display the file by issuing the following
command:
print &cgivar_eval_head ($template,\%cgivar);
As you can imagine the file is divided in more than just one part.
Indeed currently four parts are supported:
The templateThe 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 <cgivar name>.A simple example would be:
<html>
<head><title><cgivar title></title></head>
<body>
<h1><cgivar title></h1>
</body>
</html>
When using different parts of a template you'll divide it up as
follows:
[head]
<!-- Begin Entry -->
[entry]
<!-- Alternate Entry -->
[alternate]
<!-- End Entry -->
[foot]
Downloadhere
|
|