Table des matières
- The template language -- Langage des templates
- Comments -- Commentaires
- Variable types -- Types de variables
- Variable usage -- Utilisation des variables
- Array and object inspection -- Inspection des tableaux et objets
- Control structures -- Structures de contrôle
- Functions and operators -- Fonctions et opérateurs
Comments -- Commentaires
Date de publication: le mardi 29 mars 2011 à 20h39
Dernière modification: par Pascal BOYER le vendredi 1 avril 2011 à 19h56
versions 3.9, 3.10, 4.x
Just like in almost any programming language, comments can be used to add explanations, descriptions, etc. Template comments are ignored by the parser and will not be displayed in the resulting HTML output.
Comme dans la plupart des langages de programmations, les commentaires sont utilisés pour ajouter des explications, des descriptions, etc... Les commentaires présents dans les templates sont ignorés par le parser (analyseur syntaxique) de template et ne sont donc pas affichés par le navigateur.
There is only one way to add template comments, and that is by encapsulating a block of code by a matching pair of the "{*" and "*}" sequence of characters (left curly bracket + asterisk and asterisk + right curly bracket). In other words, a template comment is just like any other template code except that the curly brackets are accompanied by adjacent asterisks. It is possible to comment both single and multiple lines of code. However, nesting of comments is not supported (it is not possible to comment a chunk of code that already is a comment). The following examples demonstrate the use of comments.
Il n'existe qu'un moyen d'ajouter des commentaires dans un template: mettre du texte à l'intérieur d'accolades suivies d'astérisques, comme ceci: {* et *} En clair, un commentaire n'est rien d'autre que du code de template placé à l'intérieur de ces accolades. Il est possible de commenter une ou plusieurs lignes de code. Cependant, l'imbrication de commentaires n'est pas supportée (il n'est pas possible de commenter un commentaire). Voici quelques exemples de commentaires.
Single line comment / Commenter une seule ligne
{* This is a single line comment. *}
The example above will not produce any output.
L'exemple ci-dessus ne produira aucune sortie.
Multi-line comment / Commenter plusieurs lignes
{* This is a long comment that spans across several lines within the template file. *}
The example above will not produce any output.
L'exemple ci-dessus ne produira aucune sortie.
Nested comments (illegal) / Commentaires imbriqués (non autorisé)
{* {* Nested comments are not supported! *} This text will be displayed. *}
The example above will produce the following output
L'exemple ci-dessus produira la sortie suivante:
This text will be displayed.














