Develop and Download Open Source Software

Recent Changes

2010-08-27
2010-03-14
2010-01-13
2010-01-12

Wiki Guide

Side Bar

display()

display() -- テンプレートを表示します。

説明

void display (string template)

テンプレートを表示します (fetch() と違い出力を行います)。第1パラメータには、テンプレートを指定します。

例. display()
<?php
$simplate = new Smarty();
$simplate->caching = true;

$address = '245 N 50th';
$db_data = array(
               'City' => 'Tokyo',
               'State' => 'Japan',
               'Zip' => '100000'
             );
$simplate->assign('Name', 'Yamada');
$simplate->assign('Address', $address);
$simplate->assign('data', $db_data);

// 出力を表示します
$smarty->display('index.tpl');
?>
例. display() 関数にフルパスを指定した例

$template_dir ディレクトリ外のファイルを表示するためには、フルパスを指定します。

<?php
// ファイルの絶対パス
$simplate->display('/usr/local/include/template/header.tpl');

// windows環境の絶対パス
$simplate->display('C:/www/pub/template/header.tpl');
?>

fetch() も参照してください。


SourceForge.JP is a Japanese version of SourceForge.net. For developments that are not related to Japan, we recommend you to use SourceForge.net.