# GeneWeb - Customization of pages

This part indicates how to customize the welcome pages and the other pages and to put associated pages. It is written for people having handled GeneWeb already and who want to go into the details.

- Welcome page
- Macros
- Associated pages
- Customization of all the pages

### Welcome page

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/foo.txt
- hdir/lang/lg/foo.txt
- bdir/lang/foo.txt
- hdir/lang/foo.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.

### Macros

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.
- Conditionals.
  Conditionals start with "`%I`" followed by a boolean expression (true or false) and end with "`%E`". The text between these two macros is displayed if and only if the boolean expression is true. A boolean expression is either:
  - "`f`" : we are "friend"
  - "`w`" : we are "wizard"
  - "`j`" : we are "wizard" just "friend" (cf file a.gwf, "wizard_just_friend")
  - "`c`" : we are in cgi mode
  - "`h`" : there is a history file
  - "`l`" : the browser does not treat tables
  - "`n`" : there are notes for the database
  - "`t`" : there is a search by nobility titles
  - "`z`" : there is a person selected as Sosa reference (see macro "`%u`")
  - "`a`" : there is a global access restriction for the database
  - "`N`" : contrary of the following expression
  - "`|`" : logical "or" between the two following expressions
  - "`&`" : logical "and" between the two following expressions
  Examples:
  - display the text if there is a search by title: `%It...%E`
  - display the text if we are neither "wizard" nor "friend": `%I&NwNf...%E`
- 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.gwf" 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.
  - "`%u`" : person selected as Sosa reference.
  - "`%%`": 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.

### Associated pages

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 of the famous persons of your base, make a file named "famous.txt" 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="%sem=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".

### All the pages

The pages, the welcome page included, can be customized in three places:

- You can add a file named base.hed (if "base" is the name of your database) which will be inserted in all the headers of the pages (between <head> and </head>). Allow you to insert style sheets for example. To be put in the directory "lang" and/or if you want that it be different for the language "xy" in the directory "lang/xy".
- In the same way, you can add a file named base.trl which will be inserted behind the GeneWeb copyright at each page.
- At last, you can set the variable `body_prop` of your file base.gwf which will be inserted in the tag "<body>" of all the pages. Useful to put a background color or image or to change the colours of the displayed texts. See this section of the chapter "how to start with GeneWeb".

Return to Directions for Use

Copyright (c) 1998-2005 INRIA - GeneWeb