Structure of a WIMS module
Each WIMS module has a private home directory in which go all the files
of this module.
A module must have at least the following files:
A variable definition file var.def.
This file defines external variables of the module. A parameter given by the
user must have a name declared in this file, except parameter names reserved by
WIMS (cmd, session, module, ...). And exactly variables declared in this
file will be saved in the session directory (to be recalled at the next
request from the same session).
A variable processing file var.proc.
This file is processed at EACH request of the module (except special
requests: when cmd=intro or getins).
A main phtml file main.phtml.
This file will be processed at avery request to the module, except under
special commands (when cmd=intro or getins).
An indexing file INDEX, which defines the application's nature.
This file will be used by WIMS database for searching available modules.
And it may often contain the following (optional) files too:
A variable initialisation file var.init.
This file has the same syntax as the file var.proc, and is processed
exactly at requests with cmd=new or cmd=renew.
A introductory page intro.phtml.
This is a phtml file, which is processed when the module is
accessed with cmd=intro. It is usually used to introduce the content of the
module, and to let the user choose starting options.
There may be any number of other files, like a README.md file, one or more
help pages, an about page, one or more graphics files, files called by one
of the above mandatory or optional files, etc.
Variable processing files
The files var.init and var.proc,
as well as any files called by these two
files, are variable processing files.
A variable processing file is divided into lines, separated by
non-escaped new-line characters. A new-line character can be escaped by the
character \, in which case it does not separate the two lines
before and after it.
Every line of a variable processing file must be one of the following:
- A comment line, whose first non-space character is either the character
#, or ! followed by another !.
- A variable definition line, in the form of
name=value. The content of
value may be a string (if this string contains a new-line
character, it must be escaped by the character \), or a WIMS
variable command (which must then start with the character !).
- A command line, whose first non-space character is the character
!, followed by the command name and optional parameters.
If the command produces an output string, this output will be ignored.
- A label line, whose first non-space character is the character
:, followed by the name of the label. Anything following the
label name will be considered as comment and ignored by the interpreter.
Label is used in conjunction with the jumping command
!goto.
A label starting with the character '*' is catch-all, matching any
!goto label.
-
Any line not fitting into one of the above 4 will generate a WIMS error
message.
Phtml files
The files main.phtml and intro.phtml, as well as any files called by these
two files, are phtml files (programmable html).
A phtml file is an ordinary html file, except for lines whose
first non-space character is a ! or a :.
Lines can be escaped by \, just as in the case of a variable
processing file.
A line starting with : is a label line, as in the case of a
variable processing file.
A line starting with ! is a command line, as in the case of a
variable processing file. To the difference that if the command produces an
output string, this output will be inserted into the html page, at the place
of the line.
Lines not of the above two types will be sent to the http client, after
substitution of variables.