mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-08 16:21:39 +01:00
added Japanese translation files.
This commit is contained in:
98
docs/ja/programmers/plugins/plugins-compiler-functions.xml
Normal file
98
docs/ja/programmers/plugins/plugins-compiler-functions.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: takagi Status: ready -->
|
||||
<!-- CREDITS: mat-sh,daichi,joe -->
|
||||
<sect1 id="plugins.compiler.functions"><title>コンパイラ関数プラグイン</title>
|
||||
<para>
|
||||
コンパイラ関数プラグインはテンプレートのコンパイル時にのみ呼び出されます。
|
||||
これらのプラグインは、PHPコードまたは時間に依存する静的コンテンツをテンプレートに含める時に便利です。
|
||||
コンパイラ関数と <link linkend="language.custom.functions">カスタム関数</link>
|
||||
が双方とも同じ名前で登録された場合は、コンパイラ関数が優先されます。
|
||||
</para>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>mixed <function>smarty_compiler_<replaceable>name</replaceable></function></funcdef>
|
||||
<paramdef>string <parameter>$tag_arg</parameter></paramdef>
|
||||
<paramdef>object <parameter>&$smarty</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
コンパイラ関数には2つのパラメータを渡します。
|
||||
これらのパラメータは、タグ内の文字列(基本的に関数名から終端デリミタまでの全ての文字列)と、
|
||||
Smartyのオブジェクトです。戻り値には、コンパイルされたテンプレートに挿入されるPHPコードを返します。
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>シンプルなコンパイラ関数プラグイン</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: compiler.tplheader.php
|
||||
* Type: compiler
|
||||
* Name: tplheader
|
||||
* Purpose: ソースファイル名とそれがコンパイルされた時間を含む
|
||||
* ヘッダを出力する
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_compiler_tplheader($tag_arg, &$smarty)
|
||||
{
|
||||
return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
この関数はテンプレートから次のように呼ばれます。
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* この関数はコンパイル時にのみ呼び出されます *}
|
||||
{tplheader}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
コンパイルされたテンプレートの結果として生じるPHPコードは次のようになります。
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo 'index.tpl compiled at 2002-02-20 20:02';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
<link linkend="api.register.compiler.function">
|
||||
<varname>register_compiler_function()</varname></link>
|
||||
および
|
||||
<link linkend="api.unregister.compiler.function">
|
||||
<varname>unregister_compiler_function()</varname></link>
|
||||
も参照してください。
|
||||
</para>
|
||||
|
||||
</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
|
||||
-->
|
||||
Reference in New Issue
Block a user