1 #include <infodrom.style>
2 #include <projects.style>
4 <projectpg project="cgilib" maxcontrib=5>
6 <h3>The CGI Variable library</h3>
8 This library intends to help people maintaining web sites with
9 included CGI-support, e.g. as connection to a database or something
12 The library helps you to divide between design and content. Thus
13 the person who works on web design does not need to know about
14 programming and the person who does the actual cgi programming does
15 not need to know anything about HTML and web design. <p>
17 The past has shown that often these people only want or can work on
18 one of the two issues but not on both. However, you'll need to
19 understand that design and content are divided and the person
20 writing the CGI program does not need (or does now want) to munch
23 <h3>Supported languages</h3>
25 Currently only Perl is supported. Support for C is urgently
30 Place the file cgivar.pl in /usr/local/lib/site_perl/ or whereever
31 your Perl installation expects additional .pl files. <p>
35 To add cgivar support to your programm, simply add the following
36 line at the top of it: <p>
39 require 'cgivar.pl'; # HTML-Parser
43 You will have to open the template file first and pass an arbitrary
44 amount of (name,value) pairs to the display routine. The template
48 &cgivar_load ($template);
51 Where $template refers to the full path to the template. You may
52 call your template foo.html in order to let Editors (preferred:
53 Emacs) recognize it as HTML file. This will make the library
54 evaluate the template and store it in its internal data structures.
55 You may load more than one template at the same time. <p>
57 If that's done you may now fill a hash with (name,value) pairs such
61 $cgivar{'name'} = 'Martin Schulze';
62 $cgivar{'email'} = 'joey@linux.de';
65 Then let the library display the file by issuing the following
69 print &cgivar_eval_head ($template,\%cgivar);
72 As you can imagine the file is divided in more than just one part.
73 Indeed currently four parts are supported: <p>
77 <dd> Head of a template.
80 <dd> Foot of a template.
83 <dd> Middle part of a template, may be repeated.
86 <dd> Alternate middle part, e.g. if no entries were found.
89 Dividing up a template gives you a chance to provide variable HTML
90 code if this is required, e.g. when browsing through entries of a
91 database. In that case, you will call cgivar_eval_entry() as often
96 The template is - you guessed it - HTML code basically. However,
97 some variables need to be present to be replaced by their actual
98 values. These are denoted by <cgivar name>. <p>
100 A simple example would be: <p>
104 <head><title><cgivar title></title></head>
106 <h1><cgivar title></h1>
111 When using different parts of a template you'll divide it up as
116 <!-- Begin Entry -->
118 <!-- Alternate Entry -->
120 <!-- End Entry -->
126 <a href="download/cgivar.pl">here</a> <p>