mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-08 16:21:39 +01:00
73 lines
2.2 KiB
XML
73 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- $Revision$ -->
|
||
<!-- EN-Revision: 1.5 Maintainer: takagi Status: ready -->
|
||
<!-- CREDITS: mat-sh,daichi,joe -->
|
||
<sect1 id="plugins.inserts"><title>インサートプラグイン</title>
|
||
<para>
|
||
インサートプラグインは、テンプレートの
|
||
<link linkend="language.function.insert"><varname>{insert}</varname></link>
|
||
タグによって呼び出される関数を実装するために使用されます。
|
||
</para>
|
||
<funcsynopsis>
|
||
<funcprototype>
|
||
<funcdef>string <function>smarty_insert_<replaceable>name</replaceable></function></funcdef>
|
||
<paramdef>array <parameter>$params</parameter></paramdef>
|
||
<paramdef>object <parameter>&$smarty</parameter></paramdef>
|
||
</funcprototype>
|
||
</funcsynopsis>
|
||
<para>
|
||
この関数の第1パラメータは、insert タグに渡される属性の連想配列です。
|
||
</para>
|
||
<para>
|
||
インサートプラグイン関数は戻り値として、
|
||
テンプレートの <varname>{insert}</varname> タグの部分を置き換える結果を返します。
|
||
</para>
|
||
<example>
|
||
<title>インサートプラグイン</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
/*
|
||
* Smarty plugin
|
||
* -------------------------------------------------------------
|
||
* File: insert.time.php
|
||
* Type: time
|
||
* Name: time
|
||
* Purpose: 現在の日付/時刻をフォーマットにしたがってインサートする
|
||
* -------------------------------------------------------------
|
||
*/
|
||
function smarty_insert_time($params, &$smarty)
|
||
{
|
||
if (empty($params['format'])) {
|
||
$smarty->trigger_error("insert time: missing 'format' parameter");
|
||
return;
|
||
}
|
||
return strftime($params['format']);
|
||
}
|
||
?>
|
||
]]>
|
||
</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
|
||
-->
|