Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

Name

compileAllTemplates() — すべての既知のテンプレートをコンパイルする

説明

string compileAllTemplates(string extension,
                           boolean force,
                           integer timelimit,
                           integer maxerror);

この関数は、$template_dir にあるすべてのテンプレートファイルをコンパイルします。次のパラメータを使います。

  • extension はオプションの文字列で、テンプレートファイルの拡張子を定義します。 デフォルトは ".tpl" です。

  • force はオプションの boolean 値で、変更されたテンプレートのみをコンパイルする (false) か、すべてのテンプレートをコンパイルする (true) かを決めます。 デフォルトは "false" です。

  • timelimit はオプションの整数値で、コンパイル処理の時間制限を秒単位で指定します。 デフォルトは無制限です。

  • maxerror はオプションの静数値で、エラーの制限を設定します。 この設定を超える数のテンプレートがコンパイルに失敗すると、この関数の処理は中断されます。 デフォルトは無制限です。

Note

この関数は、すべての設定に対して望み通りの結果を得られるとは限りません。自己責任のもとで使ってください。

Note

プラグインやフィルタ、オブジェクトの登録を要するテンプレートについては、 この関数を実行する前にそれらをすべて登録しておかなければなりません。

Note

テンプレートの継承を使っている場合はこの関数は親テンプレートをコンパイルします。 これは決して使われることがありません。

Example 13.12. compileAllTemplates()


<?php
include('Smarty.class.php');
$smarty = new Smarty;

// すべてのテンプレートファイルを強制的にコンパイルします
$smarty->compileAllTemplates('.tpl',true);

?>