cvs: smarty / NEWS /libs/plugins function.config_load.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1060858770@cvsserver>
messju		Thu Aug 14 06:59:30 2003 EDT

  Modified files:              
    /smarty	NEWS 
    /smarty/libs/plugins	function.config_load.php 
  Log:
  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
  
  
  
Index: smarty/NEWS
diff -u smarty/NEWS:1.388 smarty/NEWS:1.389
--- smarty/NEWS:1.388	Mon Aug 11 11:55:39 2003
+++ smarty/NEWS	Thu Aug 14 06:59:30 2003
@@ -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)
 -----------------------------------
 
Index: smarty/libs/plugins/function.config_load.php
diff -u smarty/libs/plugins/function.config_load.php:1.13 smarty/libs/plugins/function.config_load.php:1.14
--- smarty/libs/plugins/function.config_load.php:1.13	Sat Jun 21 13:39:15 2003
+++ smarty/libs/plugins/function.config_load.php	Thu Aug 14 06:59:30 2003
@@ -64,7 +64,10 @@
         }
 
 		$_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 @@
 			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) {



-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.