cvs: peardoc /ja/package/html/html-template-flexy intro.xml

From: Date: Thu, 16 Jun 2005 09:29:51 +0000
Subject: cvs: peardoc /ja/package/html/html-template-flexy intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-6358@lists.php.net to get a copy of this message
haruki Thu Jun 16 05:29:51 2005 EDT Modified files: /peardoc/ja/package/html/html-template-flexy intro.xml Log: sync with en. but now in working

http://cvs.php.net/diff.php/peardoc/ja/package/html/html-template-flexy/intro.xml?r1=1.2&r2=1.3&ty=u Index: peardoc/ja/package/html/html-template-flexy/intro.xml diff -u peardoc/ja/package/html/html-template-flexy/intro.xml:1.2 peardoc/ja/package/html/html-template-flexy/intro.xml:1.3 --- peardoc/ja/package/html/html-template-flexy/intro.xml:1.2 Tue Jan 27 00:36:08 2004 +++ peardoc/ja/package/html/html-template-flexy/intro.xml Thu Jun 16 05:29:50 2005 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> -<!-- $Revision: 1.2 $ --> -<!-- Sync: 1.6 --> +<!-- $Revision: 1.3 $ --> +<!-- EN-Revision: 1.10 Maintainer: Status: working --> +<!-- CREDITS: elf, haruki --> <refentry id="package.html.html-template-flexy.intro"> <refnamediv> <refname>導入</refname> @@ -11,66 +12,122 @@ <refsect1> <title>導入</title> <para> - HTML_Template_Flexy は、HTML_Template_Xipe をシンプルにするところから始まりました。 - しかしバージョン 0.2 の時点で regex による正規表現で置換を行うのではなく、 - 本格的な文法解析エンジン (Lexer) を備えた最初のテンプレートの一つになりました。 - これにより ASP.NET や ColdFusion と同様の事が出来るようになっています。 - ですが、次に示すように Flexy のゴールは常にシンプルです。 + HTML_Template_Flexy は、HTML_Template_Xipe をシンプルにするところから始められました。 + しかし、Flexy の長期的な目標は、PHP + ネイティブでコンパイルを行うタイプのテンプレートに対する + 汎用的な基礎 API を作り上げることにあります。 + </para> + + <para> + Flexy currently supports a number of backends (Template Formats), and is designed to be extended to + support more, The Key Formats are: </para> <para> <itemizedlist> <listitem> - <simpara>簡単に学べる非常にシンプルな API</simpara> + <simpara>Standard - A rich Tokenizer driven engine, that uses {variable_placeholders}, + attribute based (flexy:foreach=&quot;....&quot;), and custom tag &lt;flexy:tojavascript ... + To rapidly create PHP code from simple markup. + These templates are designed to be editable in WYSIWYG HTML editors, + without breaking the tags</simpara> + </listitem> + + + <listitem> + <simpara>Regex - A classic templating backend, for supporting Smarty, Xipe, or Email + type convertion to PHP code. + </simpara> + </listitem> + + + <listitem> + <simpara>Raw - A non compiling backend, that enables you to create templates using PHP, + Useful if you intend to redistribute your application and are concerned about compilation + </simpara> </listitem> + + </itemizedlist> + </para> + + <para> + Data can be assigned in two ways with flexy, depending on your prefered style of working. + </para> + <para> + <itemizedlist> <listitem> - <simpara>オブジェクトベースのシステムを対象とし、デフォルトの振る舞いはオブジェクトの値を表示するだけ。</simpara> + <simpara>Push - you put data into the template engine, using $flexy-&gt;setData(), + and $flexy-&gt;setDataByRef(), this is similar to the way Smarty and other templates + work. + </simpara> </listitem> <listitem> - <para><link linkend="standards">PEAR 標準</link> にのっとった変数のドキュメンテーションが可能で、 - 例えばオブジェクトの変数は <link linkend="package.php.phpdoc">PHPDoc</link> 形式でソースコードに記述できること。</para> + <simpara>Push/Pull - You provide the outputer with a Data Provider Object, (either a Data Object, or a Controller) + that contains the data to display (and objects with methods that can be called). This has + the added benefit of making the Variables in the template documentable, + using <link linkend="standards">PEAR standards</link>, + eg. <link linkend="package.php.phpdocumentor">PHPDoc</link> comments. + </simpara> </listitem> + + </itemizedlist> + </para> + + <para> + With all this Flexibility, it still manages to achieve + </para> + <para> + <itemizedlist> <listitem> - <simpara>WYSIWYG なエディタ HTML エディタを使ってテンプレートを編集してもタグが壊れないこと。</simpara> + <simpara>Very Lightweight Simple API, which easy to learn</simpara> </listitem> <listitem> - <simpara>ループ構造やブロック構造が、テンプレートのデザイン時に於いては簡単に記述する事ができ、実行時に於いては単純かつ高速に処理されること。</simpara> - </listitem> + <simpara>In Normal operation very little code is actually loaded (so it's fast)</simpara> + </listitem> + </itemizedlist> </para> - </refsect1> + <refsect1> <title>HTML_Template_Flexy と他のテンプレートシステムとの違い</title> <para> - PHP には様々なテンプレートシステムがありますが、 - 大体は 置換を行うタイプと PHP のコードを生成するタイプに二分出来ます。 + PHP には様々なテンプレートシステムがありますが、おおよそ + 「置換型」もしくは 「PHP コード生成型」のシステムに二分できます。 </para> <para> - 置換を行うテンプレートエンジンでは、 - 例えば <link linkend="package.html.html-template-it">HTML_Template_IT</link>、FastTemplate、PhpLib テンプレートがあります。 - この手のテンプレートは、大体はブロックや入れ子構造に於いて実行速度が遅く、 - 変数の指定にも色々と手間がかかりがちです。 + 置換型のテンプレートエンジンには、 + たとえば <link + linkend="package.html.html-template-it">HTML_Template_IT</link>、 + FastTemplate、PhpLib テンプレートがあります。 + この種のテンプレートは、総体的に、ブロックや入れ子構造において + 実行速度が遅く、変数の指定にもコードを多く書く手間がかかりがちです。 </para> <para> - PHP のコードを生成するタイプのテンプレートエンジンには Flexy、Smarty、SimpleTemplate (HTML_Template_Xipe に改名) があります。 - 大体は複雑なテンプレートでもうまく扱うことができ、拡張性に於いても優れています。 + PHP コード生成型のテンプレートエンジンには Flexy、Smarty、 + SimpleTemplate (HTML_Template_Xipe に改名) などがあります。 + これらは、複雑なテンプレートでもうまく扱うことができ、 + 拡張性にも優れています。 + (Flexy の長期的な目標は、これらのPHP コード生成型のテンプレートの + サポートをひとつのパッケージで行うという所にあります。) </para> <para> - With Version 0.2, and the introduction of a full Lexer, Flexy offers unique HTML integration with - it's foreach,if attributes - and the ability to replace HTML Forms with standard PHP code. + The Standard Compiling Backend uses a Tokenizer, which offers the possiblities of + using HTML tags and attributes to provide looping and conditionals, and + make dynamic XML_Tree like elements of HTML Forms that can be manipulated + in your code. (This conversion is only done once when the template compiles) </para> </refsect1> <refsect1> <title>使用例</title> <para> - Flexy では通常、MVC モデルでいうコントローラーに該当するクラスでテンプレートを扱います。 - 結果を出力するには、<classname>HTML_Template_Flexy</classname> にテンプレートの名前とオブジェクトを渡すだけです。 - テンプレートで用いる変数はこのオブジェクトにセットされている必要があります。 + Flexy のテンプレートは、通常、(MVC モデルでいう)コントローラクラスからコールされます。 + 結果を出力するには、<classname>HTML_Template_Flexy</classname> + に、テンプレートの名前と出力対象のオブジェクトを渡すだけです。 + テンプレートで出力に用いられる変数はこのオブジェクトにセットされている必要があります。 </para> <example> - <title><classname>HTML_Template_Flexy</classname>の使用法</title> + <title><classname>HTML_Template_Flexy</classname> の使用法</title> <programlisting role="php"> <![CDATA[ <?php @@ -141,7 +198,6 @@ } - } /* ページコントローラーのインスタンスを生成 - ファクトリーメソッドを適用し、ページコントローラークラスを管理統括するページでの実装が適当 */ @@ -154,7 +210,7 @@ </programlisting> </example> <para> - 次はテンプレートです。 + 次に、テンプレートの例を示します。 </para> <example> <title><classname>HTML_Template_Flexy</classname> テンプレートの例</title>
« previous php.pear.doc (#6358) next »