08/07/21 01:40:20 8uak49aQ
■ MySmarty.class.php
<?php
require_once("Smarty/Smarty.class.php");
classMySmartyextendsSmarty {
publicfunction__construct() {
$this->Smarty();
$this->template_dir="./data/templates";
$this->compile_dir="./data/templates_c";
}
}
?>
■ test.php(MySmarty.class.php と同じディレクトリ) → 正常に動作
<?php
require_once( './MySmarty.class.php' );
$o_smarty = new MySmarty();
$o_smarty->display( "main.tpl" );
?>
■ dir.php(MySmarty.class.php の直下のフォルダ) → エラー
Warning: Smarty error: unable to read resource: "main.tpl" in C:\hoge\Smarty\Smarty.class.php on line 1092
<?php
require_once( '../MySmarty.class.php' );
$o_smarty = new MySmarty();
$o_smarty->display( "main.tpl" );
?>
これは仕様なの?