关于二级目录配置问题

#1 eianby

关于在二级目录中配置compile_dir(编译目录)与上一级编译目录为同一个目录里出现的问题:
index.php配置如下:
define("APP_PATH",dirname(__FILE__));
define("SP_PATH", APP_PATH);
$spConfig = array(
  'view' => array(
      'enabled' => TRUE, // 开启视图
      'config' =>array(
       'template_dir' => APP_PATH.'/tpl', // 模板目录
       'compile_dir' => APP_PATH.'/tmp', // 编译目录
      'cache_dir' => APP_PATH.'/tmp', // 缓存目录
     'left_delimiter' => '<{',  // smarty左限定符
     'right_delimiter' => '}>', // smarty右限定符
  ),
);
admin/index.php配置如下:
define("APP_PATH",dirname(__FILE__));
define("SP_PATH", "..");
$spConfig = array(
  'view' => array(
      'enabled' => TRUE, // 开启视图
      'config' =>array(
      'template_dir' => APP_PATH.'/tpl', // 模板目录
      'compile_dir' => '../tmp', // 编译目录
   'cache_dir' => '../tmp', // 缓存目录
   'left_delimiter' => '<{',  // smarty左限定符
   'right_delimiter' => '}>', // smarty右限定符
  ),
);
同时,tpl/main/index.html为:http://localhost/index.php的模板,内容为  

index


admin/tpl/main/index.html为:http://localhost/admin/index.php的模板,内容为

admin


这样,问题就出现了:
第一次如果先访问http://localhost/index.php,后面无论是访问http://localhost/index.php,还是http://localhost/admin/index.php页面显示结果均为 :

index


反之:
第一次如果先访问http://localhost/admin/index.php,后面无论是访问http://localhost/index.php,还是http://localhost/admin/index.php页面显示结果均为 :

admin



请修复此BUG!!!

2010-05-10 10:27:56

#2 jake

这不是bug,在smarty的设计里面,基本上不会考虑有人会“重用”编译文件,因为那些都是smarty本身进行管理的。
建议一下,编译的临时文件,还是需要分开的好,这是一个编程习惯。比如说tmp/a是一个程序的编译目录,tmp/b是另一个的。

2010-05-10 10:55:55