template_dirとcompile_dirのパス
<?php
// Smarty
define('SMARTY_DIR', '/usr/local/lib/smarty-3.1.35/libs/');
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = "../layout/";
$smarty->compile_dir = "../template_c/";
$smarty->display("layout.tpl");
- ディレクトリ構造
test--
|-layout
| |_layout.tpl
|
|-module
| |_module.php
|
|-template_c
- この場合module.phpからlayout.tplを表示するため一階層上のlayoutの中の...と記述する
template_dir = "../layout/";
compile_dir = "../template_c/";
- displayについてはtemplate_dirの続きからファイルを指定
display("layout.tpl");