fixes in config_load:

- handling of section-attribute
- reusing the same config-file multiple times
- serialization of config-data for php<4.2.0 (no var_export)

many thanks to atu for pointing this out and for testing
This commit is contained in:
messju
2003-08-14 10:59:30 +00:00
parent 1363902a1b
commit ef13d8b606
2 changed files with 9 additions and 3 deletions

3
NEWS
View File

@@ -1,3 +1,6 @@
- fixed config_load: handling of section-attribute and use of
multiple config-files in one template (atu, messju)
Version 2.6.0-RC1 (August 11, 2003)
-----------------------------------

View File

@@ -64,7 +64,10 @@ function smarty_function_config_load($params, &$smarty)
}
$_file_path = $_config_dir . DIRECTORY_SEPARATOR . $_file;
$_compile_file = $smarty->_get_compile_path($_file_path);
if (isset($_section))
$_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section);
else
$_compile_file = $smarty->_get_compile_path($_file_path);
if($smarty->force_compile
|| !file_exists($_compile_file)
@@ -85,13 +88,13 @@ function smarty_function_config_load($params, &$smarty)
if(function_exists('var_export')) {
$_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>';
} else {
$_output = '<?php $_config_vars = unserialize(' . serialize($_config_vars) . '); ?>';
$_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>';
}
$_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => filemtime($_file_path)));
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_compiled_resource.php');
smarty_core_write_compiled_resource($_params, $smarty);
} else {
include_once($_compile_file);
include($_compile_file);
}
if ($smarty->caching) {