Commit adf5189f authored by hancong03's avatar hancong03

增加smarty库目录自动创建

Signed-off-by: 's avatarhancong03 <hancong03@baidu.com>
parent 356cc4a7
...@@ -18,11 +18,11 @@ class Tpl { ...@@ -18,11 +18,11 @@ class Tpl {
$dir = dirname( __FILE__ ) . '/'; $dir = dirname( __FILE__ ) . '/';
$smarty->config_dir = $dir . "tmp/configs"; $smarty->config_dir = self::createDir( $dir . "tmp/configs" );
$smarty->caching = false; $smarty->caching = false;
$smarty->template_dir = $dir . "tpl"; $smarty->template_dir = self::createDir( $dir . "tpl" );
$smarty->compile_dir = $dir . "tmp/templates_c"; $smarty->compile_dir = self::createDir( $dir . "tmp/templates_c" );
$smarty->cache_dir = $dir . "tmp/cahce"; $smarty->cache_dir = self::createDir( $dir . "tmp/cahce" );
if ( !empty( $data ) ) { if ( !empty( $data ) ) {
foreach ( $data as $k=>$v ) { foreach ( $data as $k=>$v ) {
...@@ -34,4 +34,18 @@ class Tpl { ...@@ -34,4 +34,18 @@ class Tpl {
} }
private static function createDir ( $path ) {
if ( file_exists( $path ) ) {
return $path;
}
if ( !mkdir( $path, 0700, true ) ) {
throw new Exception( "directory creation failed: " . $path );
}
return $path;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment