GeneWeb - Customization of pages
This part indicates how to customize the welcome pages and to put
associated pages. It is written for people having handled
GeneWeb already and who want to go into the details.
The welcome page is built from text files, the files "start.txt"
provided with the distribution of GeneWeb. It is possible to
modify these files and/or make a specific version for a given
database.
These files contain HTML mixed with "macros" (see following section).
If you want to create such files or modify them, do not use an HTML
editor, but a normal text editor.
To build the welcome page of the base "foo", GeneWeb will
look for the following files, in this order:
- bdir/lang/lg/toto.txt
- hdir/lang/lg/toto.txt
- bdir/lang/toto.txt
- hdir/lang/toto.txt
- bdir/lang/lg/start.txt
- hdir/lang/lg/start.txt
- bdir/lang/start.txt
- hdir/lang/start.txt
where:
- "bdir" = value of "-bd" of the command "gwd" (default: current
directory).
- "hdir" = value of "-hd" of the command "gwd" (default: current
directory).
- "lg" = current language.
The files "hdir/lang/lg/start.txt" are provided with the distribution.
To make the custom file, the simplest way is to start from a copy of a
file "start.txt" which you will arrange as you want. If the
presentation of the files "start.txt" do not suit you, you can also
change them directly.
Warning however: from a version of GeneWeb to the other, the
files "start.txt" may have been improved. If you take a new version
and want to benefit from the improvements, look at the files
"start.txt" to see where they have been modified and include their
modifications in your customized files.
As indicated previously, the files of welcome pages are not pure HTML.
They hold "macros". They are sequences beginning with the character
"%" and followed by a letter. Examples: "%s", "%x", etc.
These macros is replaced by values which depend on the context: name
of the base, language, number of persons in the base, etc.
There is also a particular processing for the brackets "[" and "]": if
the text between hooks is translated in the current language from the
lexicon (file "lexicon.txt") with the following modifications:
- If there is a star after the opening bracket, the first letter of
the translation is capitalized.
- If the closing bracket is followed of a number, that correspond to
the N-2nd occurrence of translation (starting with 0), the occurrences
being separated by slashes. If this occurrence does not exist, the
first one is taken.
To understand how the macros are used, the best is to look at the
files "start.txt" provided in the distribution.
Here the meanings of the macros "%":
- Base.
- "%t": name of the base.
- "%f": in server mode, name of the
base, followed by the possible password (ex: "foo_xyzzy"); in CGI
mode, name of CGI command (ex: "gwd.exe").
- "%g": in server mode, like "%f"; in
CGI mode, name of CGI command followed by "?b=", the name of the base
and a semicolon (ex: "gwd.exe?b=foo;").
- "%s": value of "%f" followed by a
question mark and contextual variables (see below) followed by a
semicolon. Ex: "foo?lang=it;iz=8233;".
- Count.
- "%c": number of accesses to the
welcome page.
- "%q": number of requests.
- "%d": date of the first
consultation.
- Conditional.
- "%w... %w": display if "wizard".
- "%x... %x": display if "wizard" or
"friend".
- "%y... %y": display if "server" mode
(not CGI) and not "wizard".
- "%z... %z": display if "server" mode
(not CGI) and neither "wizard" nor "friend".
- "%i... %i": display if CGI mode.
- Others.
- "%r" followed by a name and a
new line: inclusion of the file "name.txt".
- "%b": value of the variable
"body_prop" of the file "foo.cnf" for the base "foo".
- "%h": contextual variables (see
below) in the form "< input type=hidden name=var value=val>".
- "%l": language.
- "%n": number of persons in the database.
- "%%": only one "%".
- "%[": "[".
- "%]": "]".
Some macros refer to contextual variables. They are:
- b: in CGI mode, database name.
- lang: language.
- iz: number of the person taken as Sosa reference if any.
The conditional cannot overlap: one cannot put one
"%w... %w" inside one "%i... %i".
In your customized welcome page, you can put links to associated files
which will be treated by GeneWeb in the same way: the macros
will be transformed.
For example, if you want to put a special page on the famous persons
of your base, make a file named "famous.txt" and in the directory
"bdir/lang/lg" or in the directory "bdir/lang" (see first section).
The request of access to "famous.txt" is: "m=H;v=famous". In the
welcome page, you will thus put:
<a href="%sm=H;v=famous">Famous</a> persons of my
database.
In "famous.txt", you can put links to persons of your base, independently
from his name and from the context, using the appropriate macros.
The particularly interesting macros are:
- "%b" you can put in the tag
"<body>" writing it "<body%b>".
- "%s" you can use in links.
Example of sentence in "famous.txt":
See my cousin <a href="%sp=louis;n=de+bourbon;oc=5">
Louis XIV</a> and my
<a href="%em=R;ep=john;en=smith;m=NG;n=louis+xiv;t=PN">
relationship links</a> with him.
See how to make correct links to GeneWeb
pages as well.
Notice that the "advanced request" works like an associated file named
"advanced.txt".
Return to Directions for Use.
© Copyright INRIA 1999 -
GeneWeb