Files
smarty/docs/fr/programmers/plugins/plugins-inserts.xml

77 lines
2.1 KiB
XML
Raw Normal View History

2004-04-13 11:47:32 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
2004-12-26 20:05:31 +00:00
<!-- EN-Revision: 1.2 Maintainer: yannick Status: ready -->
<sect1 id="plugins.inserts">
<title>Insertions</title>
<para>
Les plugins d'insertion sont utilis<69>s pour impl<70>menter les fonctions
qui sont appel<65>es par les balises
<link linkend="language.function.insert"><command>insert</command></link>
dans les templates.
</para>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>smarty_insert_<replaceable>name</replaceable></function></funcdef>
<paramdef>array <parameter>$params</parameter></paramdef>
<paramdef>object <parameter>&amp;$smarty</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
2004-12-26 21:12:45 +00:00
Le premier param<61>tre pass<73> <20> la fonction est une tableau associatif
2004-12-26 20:05:31 +00:00
d'attributs.
</para>
<para>
La fonction d'insertion est suppos<6F>e retourner le r<>sultat qui sera
substitu<74> <20> la balise <command>insert</command> dans le template.
</para>
<example>
<title>Plugin d'insertion</title>
<programlisting role="php">
<![CDATA[
<?php
2004-04-13 11:47:32 +00:00
/*
* Smarty plugin
* -------------------------------------------------------------
* Fichier : insert.time.php
* Type : temps
* Nom : time
* R<>le : Insert la date/heure courante conform<72>ment
* au format
* -------------------------------------------------------------
*/
2004-12-26 20:05:31 +00:00
function smarty_insert_time($params, &$smarty)
2004-04-13 11:47:32 +00:00
{
if (empty($params['format'])) {
$smarty->trigger_error("insert time: missing 'format' parameter");
return;
}
$datetime = strftime($params['format']);
return $datetime;
}
2004-12-26 20:05:31 +00:00
?>
]]>
</programlisting>
</example>
2004-04-13 11:47:32 +00:00
</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
2004-05-23 15:50:53 +00:00
-->