Macros in GeneWeb
|Language:||English • français|
GeneWeb template files and text captures in notes are not pure HTML and may contain variables
Some historically called macros. These are letters prefixed by
%, for instance
%x. GeneWeb replaces these macros by their values depending on the context of the base: name of the base, language, number of persons in the base, etc...
Other variables, bracketed by
] trigger the translation process of GeneWeb according to the current language, and use for this translation the Template:lexicon data. The Template:lexicon page describes in details this translation process.
Les variables encadrées par des crochets ouvrants et fermants
] (et non
%) sont traduites par GeneWeb à partir d'un lexique. La page correspondante détaille ce fonctionnement.
Description of the macros
- %t : name of the abse
- %f : in server mode (stand alone machine), name of the base, possibly followed by a token (en
toto_xyzzy); in CGI mode the launch command (ex:
- %g : in server mode, same as "%f"; in CGI mode, name of the launch command followed by
?b=, the name of the base and a semi-colon
- %s : value of "%f" followed by a question-mark
?and the contextual variables (see below) (ex:
- %n : number of persons in the base.
- %c : numbers of visits to the welcome page
- %q : number of visits to the site (one page = one visit)
- %d : date of the first visit.
Conditionnals begin by "%I" followed by a boolean expression and terminate with "%E". Text between these two delimiters is displayed only if the boolean expression evaluates as true:
- f : visitor is registered as friend
- w : visitor is registered as wizard
- j : wizard_just_frien} has been activated (see
- c : the server is in CGI mode
- h : a modifications history file exists
- l : the web browser does not handle tables
- n : a notes file exists for this base
- t : a search by nobility title has been launched
- z : there exists a sosa reference person (see "%u")
- a : access to the base is globally restricted
- N : negation of what follows
- | : logical "or" between the two following expressions (not e1&e2, but &e1e2!!)
- & : logical "and" between the two following expressions
- display some text if a search by nobility title is active: :
- display some text if visitor is not "wizard" nor "friend": :
- %r followed by text: include a file names text.txt. The file must be at the same location as the file containing the "%r"
- %b : value of the "body_prop" variable found in
- %h : contextual variables (see below), in the form "<input type=hidden name=var value=val>".
- %l : language.
- %u : person taken as sosa reference (i.e. sosa 1)
- %% : a single "%".
- %[ : a single "[".
- %] : a single "]".
Some variables have a lasting influence on GeneWeb across multiple requests. As opposed to the other requests parameters, once activated (by selecting an option through the GUI, or by direct typing in the URL window) the appear in all successive requests unless explicitly removed.
- pz, nz, ocz, iz (first_name, last-name, occurence, index of a sosa reference)
- list to be completed ...
Frequently used macros
- %b typically inserted in the
<body>HTML tag as in
- %s which you will use for any of your href links
Examples in "celebres.txt":
See my cousin <a href="%sp=louis;n=de+bourbon;oc=5"> Louis XIV</a> and my <a href="%sem=R;ep=jean;en=dupont;m=NG;n=louis+xiv;t=PN"> relationship</a> with him.
List of macros
Below is the result of calling all 26 lower case possible macros :
- this table is automatically generated by inserting a bit of HTML/GeneWeb code into the notes of one person in your base. The corresponding code is here