mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-27 02:11:37 +01:00
added italian docs. thanks to Gianluca Gillini
This commit is contained in:
86
docs/it/programmers/api-functions/api-register-function.xml
Normal file
86
docs/it/programmers/api-functions/api-register-function.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.function">
|
||||
<refnamediv>
|
||||
<refname>register_function</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_function</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>cacheable</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Si pu<70> usare questa funzione per registrare dinamicamente
|
||||
funzioni plugin per i template. Dovete fornire il nome della
|
||||
funzione di template, seguito dalla funzione PHP da richiamare
|
||||
che implementa tale funzione.
|
||||
</para>
|
||||
<para>
|
||||
Il parametro <parameter>impl</parameter>, contenente la funzione
|
||||
callback, pu<70> avere uno dei seguenti valori: (a) una stringa
|
||||
contenente il nome della funzione (b) un array nella forma
|
||||
<literal>array(&$oggetto, $metodo)</literal>, dove
|
||||
<literal>&$oggetto</literal> <20> il riferimento ad un
|
||||
oggetto e <literal>$metodo</literal> <20> una stringa contenente
|
||||
il nome di un metodo (c) un array nella forma
|
||||
<literal>array(&$classe, $metodo)</literal> dove
|
||||
<literal>$classe</literal> <20> un nome di classe e
|
||||
<literal>$metodo</literal> <20> un metodo statico della
|
||||
classe.
|
||||
</para>
|
||||
<para>
|
||||
<parameter>cacheable</parameter> e <parameter>cache_attrs</parameter>
|
||||
possono essere omessi nella maggioranza dei casi. Consultate
|
||||
<link linkend="caching.cacheable">Controllo della Cache per l'output dei Plugins</link>
|
||||
per capire come usarli.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_function</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_function("date_now", "print_current_date");
|
||||
|
||||
function print_current_date($params)
|
||||
{
|
||||
if(empty($params['format'])) {
|
||||
$format = "%b %e, %Y";
|
||||
} else {
|
||||
$format = $params['format'];
|
||||
return strftime($format,time());
|
||||
}
|
||||
}
|
||||
|
||||
// ora potete usare questa funzione in Smarty per stampare la data attuale: {date_now}
|
||||
// oppure {date_now format="%Y/%m/%d"} per formattarla.
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- 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