使用法 (
{method()}
, {method():h}
, {method():u}
, {object.method()}
, {method(with.a.variable)}
, {method(with.multiple,variables)}
, {method(with.variables,#and strings or literals#)}
)
PHP のメソッドコールを作成します。引数の数は自由です。引数には、 変数あるいはリテラル (# で囲む) のいずれも使用可能です。 返り値が表示され、修正子に (変数のように) 渡されます。
他のテンプレートの組み込み
class example_page { var $masterTemplate = "master.html"; var $bodyTemplate = "body.html"; function ucfirst($string) { return ucfirst($string); } function includeBody() { $template = new HTML_Template_Flexy(); $template->compile($this->bodyTemplate); $template->outputObject($this); } }
テンプレート内での includeBody のコールおよび ucfirst
{ucfirst(#this is the header#)} {includeBody():h} Footer Goes Here.
コンパイルされたテンプレート
<?php echo htmlspecialchars($t->ucfirst("this is the header")); ?> <?php echo $t->includeBody(); ?> Footer Goes Here.
コードの出力
This is the header Hello World Footer Goes Here.