mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-25 18:31:38 +02:00
banana split
This commit is contained in:
82
docs/fr/programmers/plugins/plugins-compiler-functions.xml
Normal file
82
docs/fr/programmers/plugins/plugins-compiler-functions.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="plugins.compiler.functions"><title>Fonctions de compilation</title>
|
||||
<para>
|
||||
Les fonctions de compilation sont appel<65>es durant la compilation du template.
|
||||
Elles sont utiles pour injecter du code PHP ou du contenu "statique variant
|
||||
avec le temps" (bandeau de pub par ex.). Si une fonction de compilation et
|
||||
une fonction personnalis<69>e ont le m<>me
|
||||
nom, la fonction de compilation a priorit<69>.
|
||||
</para>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>mixed <function>smarty_compiler_<replaceable>name</replaceable></function></funcdef>
|
||||
<paramdef>string <parameter>$tag_arg</parameter></paramdef>
|
||||
<paramdef>object <parameter>&$smarty</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
Les fonctions de compilation ont deux param<61>tres : une chaene contenant
|
||||
la balise - en gros, tout, depuis le nom de la fonction jusqu'au d<>limiteur de fin - et
|
||||
l'objet Smarty. Elles sont cens<6E>es retourner le code PHP qui doit <20>tre
|
||||
inject<63> dans le template compil<69>.
|
||||
</para>
|
||||
<para>
|
||||
Regardez aussi
|
||||
<link linkend="api.register.compiler.function">register_compiler_function()</link>,
|
||||
<link linkend="api.unregister.compiler.function">unregister_compiler_function()</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>fonction de compilation simple</title>
|
||||
<programlisting>
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* Fichier : compiler.tplheader.php
|
||||
* Type : compilation
|
||||
* Nom : tplheader
|
||||
* R<>le : Renvoie l'en-t<>te contenant le nom du fichier
|
||||
* source et le temps de compilation.
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_compiler_tplheader($tag_arg, &$smarty)
|
||||
{
|
||||
return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
|
||||
}
|
||||
?></programlisting>
|
||||
<para>
|
||||
Cette fonction peut-<2D>tre appel<65> depuis le template comme suivant :
|
||||
</para>
|
||||
<programlisting>
|
||||
{* cette fonction n'est execut<75>e que lors de la compilation *}
|
||||
{tplheader}</programlisting>
|
||||
<para>
|
||||
Le code PHP r<>sultant dans les templates compil<69>s ressemblerait a ta :
|
||||
</para>
|
||||
<programlisting>
|
||||
<php
|
||||
echo 'index.tpl compiled at 2002-02-20 20:02';
|
||||
?></programlisting>
|
||||
</example>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
Reference in New Issue
Block a user