The ecrire/public/styliser.php file determines the name and type of the template depending on the arguments which are passed to it.
$styliser = charger_fonction('styliser', 'public');
list($skel,$mime_type, $gram, $sourcefile) =
$styliser($fond, $id_rubrique_fond, $GLOBALS['spip_lang'], $connect);
A 5th argument makes it possible to request a parser (a concrete syntax) and then consequently an extension for the various template files. By default, the parser (and therefore the extension applied) is html
.
The function searches for a template named $fond.$ext
in SPIP’s path. If it does not exist, it returns an error, otherwise it atempts to find a more specific template in the same directory as the template found, depending on the id_rubrique
and lang
parameters.
Styliser then searches files like nom=8.html
, nom-8.html
, nom-8.en.html
or nom.en.html
in the following order:
-
$fond=$id_rubrique
-
$fond-$id_rubrique
-
$fond-$id_rubrique_parent_recursivement
- then whichever it has found (or not) terminated with
.$lang
The function then returns a table of elements of what it has found array($squelette, $ext, $ext, "$squelette.$ext")
:
- 1st parameter: the name of the template,
- 2nd: its extension
- 3rd: its grammar (the type of parser)
- 4th: the full name.
These parameters are used by the composer and its composer()
function.