Difference between revisions of "templates"

From GeneWeb
Jump to: navigation, search
m (t.)
(Introducing p_mod)
Line 7: Line 7:
 
* updfam.txt the page containing the form to update a family.
 
* updfam.txt the page containing the form to update a family.
  
A template is a set of such files organized into a coherent user interface. Template files are stored in folders named <code>geneweb/gw/etc/template_name</code>.
+
A template is a set of such files organized into a coherent user interface. Template files are stored in folders named [[distribution|{{c|distribution/gw/etc/template_name}}]] and [[bases|{{c|bases/etc/basename/template_name}}]]. Note that when searching for a template file, GeneWeb will search in the following order:
 +
* {{c|bases/etc/basename/template_name/file}}
 +
* {{c|bases/etc/template_name/file}} ?
 +
* {{c|distribution/gw/etc/template_name/file}}
 +
* {{c|distribution/gw/etc/file}}
 +
<!-- (this needs to be verified. Are {{c|bdir/etc/base/template}} and {{c|gw/etc/base}} looked into? Behavior changed between 6.08 and 7.00 [[User:Henri83|Henri83]] ([[User talk:Henri83|talk]]) 18:02, 16 October 2015 (CEST)).-->
  
 
Templates are invoqued by adding (through a clickable button if available, or manually if not) <code>templ=templ_name;</code> in the URL at the top of your browser. GeneWeb will "remember" this request for a template use and will automatically add the appropriate text in all subsequent URL requests.
 
Templates are invoqued by adding (through a clickable button if available, or manually if not) <code>templ=templ_name;</code> in the URL at the top of your browser. GeneWeb will "remember" this request for a template use and will automatically add the appropriate text in all subsequent URL requests.
  
When executing its tasks, '''gwd''' will search for the needed files in several folders in the following sequence:
+
As a result, you may limit your editing to the file whose content you want to change. All the other files will be found in the default folder according to the sequence above.
<pre>
+
bdir/etc/base/
+
gw/etc/template_name/
+
gw/etc/
+
</pre>
+
 
+
where {{c|-bdir}} is the value of the {{c|-bd}} parameter of '''gwd''', and {{c|gw}} is the folder in which sits gwd.
+
<!-- (this needs to be verified. Are {{c|bdir/etc/base/template}} and {{c|gw/etc/base}} looked into? Behavior changed between 6.08 and 7.00 [[User:Henri83|Henri83]] ([[User talk:Henri83|talk]]) 18:02, 16 October 2015 (CEST)).-->
+
 
+
As a result, you may limit your editing to the file whose content you want to change. All the other files will be found in the default folder.
+
  
 
See the [[expert#Template programming|experts]] section for further discussion on template programming.
 
See the [[expert#Template programming|experts]] section for further discussion on template programming.
Line 30: Line 25:
 
The code below is somewhat self explanatory:
 
The code below is somewhat self explanatory:
 
<pre>
 
<pre>
 
 
%import;perso_utils
 
%import;perso_utils
 
 
%include.perso_header;
 
%include.perso_header;
  
Line 95: Line 88:
 
perso_module_tplnb=8
 
perso_module_tplnb=8
 
</pre>
 
</pre>
 +
 +
=== Module and options selection (Version 7) )===
 +
 +
Version 7 of GeneWeb offers an aletrnative solution to module selection, augmented with the possibility to select a display option for each module.
 +
 +
Note first that the module names have been changed to :
 +
 +
<pre>
 +
perso_module_0=personnal_data
 +
perso_module_1=parents
 +
perso_module_2=unions
 +
perso_module_3=sinlings
 +
perso_module_4=relations
 +
perso_module_5=notes
 +
perso_module_6=sources
 +
perso_module_7=trees
 +
perso_module_8=timeline
 +
</pre>
 +
 +
The {{c|.gwf}} file holds another set of variable definitions using letters rather that digits:
 +
<pre>
 +
perso_module_a=personnal_data
 +
perso_module_b=parents
 +
options_parents=5
 +
perso_module_c=unions
 +
options_unions=5
 +
perso_module_d=siblings
 +
options_siblings=3
 +
perso_module_e=relations
 +
options_relations=2
 +
perso_module_f=timeline
 +
options_timeline=2
 +
perso_module_g=notes
 +
options_notes=2
 +
perso_module_h=sources
 +
options_sources=2
 +
perso_module_i=trees
 +
options_trees=8
 +
perso_module_j=gr_parents
 +
options_gr_parents=3
 +
perso_module_z=divider
 +
</pre>
 +
 +
Each module can be displayed with a choice of options ranging from 1 to the value specified in the associated {{c|options_module}} parameter.
 +
 +
The display of modules on a perso pages will be governed by a vector defining
 +
a selection amongst the modules above, and the order in which they are displayed
 +
 +
The vector appears as a string of letters and digits.
 +
Each pair "letter, digit" identifies the selected module,
 +
and the value of its display options
 +
The modules are displayed in the order in which they appear in "p_mod"
 +
In the example below, "gd_parents", "etat_civil", parents", "unino", ...
 +
 +
p_mod=j1a1b1c1d1e1f1g1h1i3
 +
 +
Selecting {{c|1=p_mod=b1b2b3B4b5}} will display all five options for the module [[c|parents}}.
 +
 +
The menubar of the {{c|perso.txt}} page provides an interface to change the value of this {{c|p_mod}} parameter.
  
 
==Examples==
 
==Examples==
The result corresponding to each choice is as follows:
 
  
 +
The result corresponding to each choice is as follows:
  
 
{|class="wikitable" style="border-width: 10px; text-align:left;"
 
{|class="wikitable" style="border-width: 10px; text-align:left;"

Revision as of 12:44, 1 December 2016

150px-Geographylogo svg.png Language: English • français

The gwd server produces the HTML code displayed by the client browser according to instructions stored into text files. Examples of such files are:

  • welcome.txt the welcome page shown when you connect to localhost:2317/basename.
  • perso.txt the page that displays one individual of the base.
  • updfam.txt the page containing the form to update a family.

A template is a set of such files organized into a coherent user interface. Template files are stored in folders named distribution/gw/etc/template_name and bases/etc/basename/template_name. Note that when searching for a template file, GeneWeb will search in the following order:

  • bases/etc/basename/template_name/file
  • bases/etc/template_name/file ?
  • distribution/gw/etc/template_name/file
  • distribution/gw/etc/file

Templates are invoqued by adding (through a clickable button if available, or manually if not) templ=templ_name; in the URL at the top of your browser. GeneWeb will "remember" this request for a template use and will automatically add the appropriate text in all subsequent URL requests.

As a result, you may limit your editing to the file whose content you want to change. All the other files will be found in the default folder according to the sequence above.

See the experts section for further discussion on template programming.

Perso.txt

The file perso.txt offers an additional customization level by providing several options for the display of personal data. The code below is somewhat self explanatory:

%import;perso_utils
%include.perso_header;

%if;(bvar.perso_module_tplnb="" or bvar.perso_module_tplnb=0)
  %apply;show_templ("perso_module/etat_civil")
  %apply;show_templ("perso_module/parent_simple")
  %apply;show_templ("perso_module/union_simple")
  %apply;show_templ("perso_module/freresoeur_simple")
  %apply;show_templ("perso_module/relations")
  %apply;show_templ("perso_module/timeline")
  %apply;show_templ("perso_module/notes")
  %apply;show_templ("perso_module/sources")
  %apply;show_templ("perso_module/arbre_3gen_v_photo")
%else;
  %for;i;0;bvar.perso_module_tplnb;
    %apply;get_templ(i)
  %end;
%end;

For most of the modules, several alternatives are available and can be selected by editing the appropriate line. here is the current content of the perso_modules folder:

drwxr-xr-x  23 Henri  staff    782  1 oct 22:26 .
drwxr-xr-x  64 Henri  staff   2176 15 oct 23:56 ..
-rw-r--r--   1 Henri  staff   3979  1 oct 22:26 arbre_3gen_v.txt
-rw-r--r--   1 Henri  staff  12691  1 oct 22:26 arbre_3gen_v_photo.txt
-rw-r--r--   1 Henri  staff  10477  1 oct 22:26 arbre_4gen_v.txt
-rw-r--r--   1 Henri  staff  19592  1 oct 22:26 arbre_5gen_h.txt
-rw-r--r--   1 Henri  staff   2303  1 oct 22:26 etat_civil.txt
-rw-r--r--   1 Henri  staff   7283  1 oct 22:26 famille.txt
-rw-r--r--   1 Henri  staff   2964  1 oct 22:26 freresoeur_complet.txt
-rw-r--r--   1 Henri  staff   2972  1 oct 22:26 freresoeur_simple.txt
-rw-r--r--   1 Henri  staff   1636  1 oct 22:26 notes.txt
-rw-r--r--   1 Henri  staff    785  1 oct 22:26 parent_complet.txt
-rw-r--r--   1 Henri  staff    431  1 oct 22:26 parent_evolue.txt
-rw-r--r--   1 Henri  staff   1653  1 oct 22:26 parent_photo.txt
-rw-r--r--   1 Henri  staff    271  1 oct 22:26 parent_simple.txt
-rw-r--r--   1 Henri  staff   1877  1 oct 22:26 relations.txt
-rw-r--r--   1 Henri  staff    360  1 oct 22:26 sources.txt
-rw-r--r--   1 Henri  staff   1099  1 oct 22:26 timeline.txt
-rw-r--r--   1 Henri  staff   7374  1 oct 22:26 union_complet.txt
-rw-r--r--   1 Henri  staff   3636  1 oct 22:26 union_evolue.txt
-rw-r--r--   1 Henri  staff   2532  1 oct 22:26 union_photo.txt
-rw-r--r--   1 Henri  staff   1861  1 oct 22:26 union_simple.txt

Changing the content of perso.txt can be achieved through a set of parameters stored in the .gwf file where the value of the parameter is the name of the desired module:

perso_module_0=etat_civil
perso_module_1=parent_simple
perso_module_2=union_simple
perso_module_3=freresoeur_simple
perso_module_4=relations
perso_module_5=notes
perso_module_6=sources
perso_module_7=arbre_3gen_v_photo

One must add a last parameter specifying the total number of sub-templates

perso_module_tplnb=8

Module and options selection (Version 7) )

Version 7 of GeneWeb offers an aletrnative solution to module selection, augmented with the possibility to select a display option for each module.

Note first that the module names have been changed to :

perso_module_0=personnal_data
perso_module_1=parents
perso_module_2=unions
perso_module_3=sinlings
perso_module_4=relations
perso_module_5=notes
perso_module_6=sources
perso_module_7=trees
perso_module_8=timeline

The .gwf file holds another set of variable definitions using letters rather that digits:

perso_module_a=personnal_data
perso_module_b=parents
options_parents=5
perso_module_c=unions
options_unions=5
perso_module_d=siblings
options_siblings=3
perso_module_e=relations
options_relations=2
perso_module_f=timeline
options_timeline=2
perso_module_g=notes
options_notes=2
perso_module_h=sources
options_sources=2
perso_module_i=trees
options_trees=8
perso_module_j=gr_parents
options_gr_parents=3
perso_module_z=divider

Each module can be displayed with a choice of options ranging from 1 to the value specified in the associated options_module parameter.

The display of modules on a perso pages will be governed by a vector defining a selection amongst the modules above, and the order in which they are displayed

The vector appears as a string of letters and digits. Each pair "letter, digit" identifies the selected module, and the value of its display options The modules are displayed in the order in which they appear in "p_mod" In the example below, "gd_parents", "etat_civil", parents", "unino", ...

p_mod=j1a1b1c1d1e1f1g1h1i3

Selecting p_mod=b1b2b3B4b5 will display all five options for the module [[c|parents}}.

The menubar of the perso.txt page provides an interface to change the value of this p_mod parameter.

Examples

The result corresponding to each choice is as follows:

File name Example
etat_civil
Personal data.
parent_simple
Parents (simple).
parent_evolue
Parents (more complex).
parent_complet
Parents (full).
parent_photo
Parents (with photo).
union_simple
Union (simple).
union_evolue
Union (more complex).
union_complet
Union (full).
union_photo
Union (with photo).
freresoeur_simple
Brothers and sisters (simple).
freresoeur_complet
Brothers and sisters (full).
famille
Family.
relations
Relations.
notes
Notes.
sources
Sources.
timeline
arbre_3gen_v
Tree, vertical, 3 generations.
arbre_nav3_photo
Tree, vertical, 3 generations with photos.
arbre_4gen_v
Tree, vertical, 4 generations.
arbre_5gen_h
Tree, horizontal, 5 generations.

GeneWeb Manual

Rembrandt Old Man Reading a Book.jpg

Use and manage genealogical databases

Technical annex