What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
コンパイルファイルを識別するための id です。すべての関数呼び出しで毎回
$compile_id
を渡すかわりに
$compile_id
を指定すると、その後は暗黙のうちにこれを使用します。
$compile_id
を使用すると、同一の
$compile_dir
を別々の
$template_dirs
で使用できないという制限を回避できます。
異なる $compile_id
をそれぞれの
$template_dir
で指定すると、Smarty はコンパイルしたテンプレートを
$compile_id
で区別します。
例として、コンパイル時刻でテンプレートをローカライズ (言語依存のパーツを翻訳)
する prefilter
を用いる場合、$compile_id
に現在の言語を使用することで、各言語についてのコンパイルしたテンプレートのセットを得ることができます。
別の例としては、複数のドメイン/複数のバーチャルホスト をまたがって同じコンパイルディレクトリを使用する場合があります。
Example 12.1. バーチャルホスト環境での $compile_id
<?php $smarty->compile_id = $_SERVER['SERVER_NAME']; $smarty->compile_dir = '/path/to/shared_compile_dir'; ?>