mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-04 16:20:55 +02:00
Typos correction and all translated now.
This commit is contained in:
92
docs/id/programmers/api-functions/api-register-function.xml
Normal file
92
docs/id/programmers/api-functions/api-register-function.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.function">
|
||||
<refnamediv>
|
||||
<refname>register_function()</refname>
|
||||
<refpurpose>secara dinamis meregistrasi plugin fungsi template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Deskripsi</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>
|
||||
Mengirimkan nama <link linkend="plugins.functions">fungsi template</link>,
|
||||
diikuti oleh nama fungsi PHP yang mengimplementasikannya.
|
||||
</para>
|
||||
&api.register.snippet;
|
||||
|
||||
|
||||
<para>
|
||||
<parameter>cacheable</parameter> dan <parameter>cache_attrs</parameter> dapat
|
||||
diabaikan. Lihat <link
|
||||
linkend="caching.cacheable">mengontrol output plugin yang dapat di-cache</link>
|
||||
atas bagaimana menggunakannya dengan benar.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_function()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_function('date_now', 'print_current_date');
|
||||
|
||||
function print_current_date($params, &$smarty)
|
||||
{
|
||||
if(empty($params['format'])) {
|
||||
$format = "%b %e, %Y";
|
||||
} else {
|
||||
$format = $params['format'];
|
||||
}
|
||||
return strftime($format,time());
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Dan dalam template
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{date_now}
|
||||
|
||||
{* atau untuk membentuk secara berbeda *}
|
||||
{date_now format="%Y/%m/%d"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Lihat juga
|
||||
<link linkend="api.unregister.function"><varname>unregister_function()</varname></link>
|
||||
dan seksi
|
||||
<link linkend="plugins.functions">fungsi plugin</link>.
|
||||
</para>
|
||||
|
||||
</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