2004-04-13 11:47:32 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
2005-12-05 21:15:38 +00:00
|
|
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
|
|
|
|
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<refentry id="api.register.modifier">
|
|
|
|
|
|
<refnamediv>
|
2005-12-05 21:15:38 +00:00
|
|
|
|
<refname>register_modifier()</refname>
|
|
|
|
|
|
<refpurpose>D<EFBFBD>clare dynamiquement un plugin de modificateur</refpurpose>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
</refnamediv>
|
|
|
|
|
|
<refsect1>
|
2005-12-05 21:15:38 +00:00
|
|
|
|
<title>Description</title>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<methodsynopsis>
|
|
|
|
|
|
<type>void</type><methodname>register_modifier</methodname>
|
|
|
|
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
|
|
|
|
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
|
|
|
|
|
</methodsynopsis>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Il faut passer en param<61>tre le nom du modificateur de variables,
|
|
|
|
|
|
suivi de la fonction PHP qui l'impl<70>mente.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
2005-12-05 21:15:38 +00:00
|
|
|
|
La fonction PHP <parameter>impl</parameter> peut <20>tre soit :
|
2004-12-26 17:02:12 +00:00
|
|
|
|
</para>
|
2005-12-05 21:15:38 +00:00
|
|
|
|
<orderedlist numeration="loweralpha">
|
|
|
|
|
|
<listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
une cha<68>ne de caract<63>res contenant le nom de la fonction
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem><listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
un tableau de la forme <literal>array(&$object, $method)</literal> o<>
|
|
|
|
|
|
<literal>&$object</literal> est une r<>f<EFBFBD>rence <20> un objet et
|
|
|
|
|
|
<literal>$method</literal> est le nom de la m<>thode
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem><listitem>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
un tableau de la forme <literal>array(&$class, $method)</literal> o<>
|
|
|
|
|
|
<literal>$class</literal> est le nom de la classe et
|
|
|
|
|
|
<literal>$method</literal> est une m<>thode de cette classe.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
</orderedlist>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<example>
|
2005-12-05 21:15:38 +00:00
|
|
|
|
<title>register_modifier()</title>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
<programlisting role="php">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
<?php
|
2004-04-13 11:47:32 +00:00
|
|
|
|
|
2005-12-05 21:15:38 +00:00
|
|
|
|
// associons la fonction PHP stripslashes a un modificateur Smarty.
|
2004-04-13 11:47:32 +00:00
|
|
|
|
$smarty->register_modifier("sslash","stripslashes");
|
|
|
|
|
|
|
2005-12-05 21:15:38 +00:00
|
|
|
|
?>
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
O<> le template est :
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
<?php
|
|
|
|
|
|
{* utiliser 'sslash' pour utiliser la fonction PHP strislashes() *}
|
|
|
|
|
|
{$var|sslash}
|
2004-12-26 17:02:12 +00:00
|
|
|
|
?>
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
</example>
|
2005-05-25 16:49:34 +00:00
|
|
|
|
<para>
|
|
|
|
|
|
Voir aussi
|
|
|
|
|
|
<link linkend="api.unregister.modifier">unregister_modifier()</link>,
|
|
|
|
|
|
<link linkend="api.register.function">register_function()</link>,
|
|
|
|
|
|
<link linkend="language.modifiers">les modifieurs</link>,
|
|
|
|
|
|
<link linkend="plugins">l'extension de Smarty avec des plugins</link> et
|
2005-12-05 21:15:38 +00:00
|
|
|
|
la <link linkend="plugins.modifiers">cr<EFBFBD>ation de plugins modifieurs</link>.
|
2005-05-25 16:49:34 +00:00
|
|
|
|
</para>
|
2004-12-26 17:02:12 +00:00
|
|
|
|
</refsect1>
|
|
|
|
|
|
</refentry>
|
2005-05-25 16:49:34 +00:00
|
|
|
|
|
2004-04-13 11:47:32 +00:00
|
|
|
|
<!-- 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
|
2005-05-25 16:49:34 +00:00
|
|
|
|
-->
|