Changes between Initial Version and Version 1 of Doc/panc/advanced


Ignore:
Timestamp:
Mar 4, 2007, 5:52:55 PM (19 years ago)
Author:
/O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Charles Loomis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Doc/panc/advanced

    v1 v1  
     1= Advanced Topics =
     2[[TracNav]]
     3
     4== Modifying the Template Load Path ==
     5
     6The pan compiler uses a load path defined on the command line to autoload templates. The autoload
     7procedure stops with the first existing template and will load a template of a given name only once.
     8One can use the LOADPATH variable to add additional relative paths to the search path. It must
     9be a list of relative paths as strings. This functionality can be used for example (in conjunction with
     10namespaces) to switch between production and test versions of templates easily:
     11object template test;
     12variable LOADPATH = ’production’;
     13#variable LOADPATH = ’test’;
     14include ’service_configuration’;
     15...
     16With a path given on the command line like {{{/pan}}}, the pan compiler will search in {{{/pan}}} and then
     17{{{/pan/production}}} for the template named service configuration. Uncommenting the test
     18line and commenting the production line will search {{{/pan/test}}} rather than {{{/pan/production}}}.
     19All combinations of the paths given on the command line and those given in the LOADPATH variable
     20are searched until the needed template is found.  The first path from the command line is searched first,
     21followed by all combinations of that path with those in the LOADPATH variable (in order), then the
     22second path from the command line, and so on.
     23
     24== Using Namespaces ==
     25
     26The pan compiler allows templates to be organized into a hierarchical directory structure. Template
     27names may contain the slash character which acts as a directory separator. For example, one can define
     28a structure template:
     29{{{
     30structure template test/stemplate;
     31’alpha’ = 20;
     32}}}
     33which can be included by the following object template:
     34{{{
     35object template test;
     36include 'test/stemplate';
     37}}}
     38assuming that the location in the file system is {{{rootdir/test/stemplate.tpl}}} and {{{rootdir}}} is include in the compiler's load path.
     39
     40Note that the full template name must always be used in the {{{include}}} statement and the template must always be a relative name (i.e. does not begin with a slash).  Object templates may not have a namespaced name.