cvs: smarty /libs Smarty.class.php /libs/core core.smarty_include_php.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1060792632@cvsserver>
messju		Wed Aug 13 12:37:12 2003 EDT

  Modified files:              
    /smarty/libs	Smarty.class.php 
    /smarty/libs/core	core.smarty_include_php.php 
  Log:
  fixed problem with vars as attributes in {include_php}
  
  
  
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.436 smarty/libs/Smarty.class.php:1.437
--- smarty/libs/Smarty.class.php:1.436	Mon Aug 11 11:55:39 2003
+++ smarty/libs/Smarty.class.php	Wed Aug 13 12:37:12 2003
@@ -43,7 +43,7 @@
  * @version 2.6.0-RC1-cvs
  */
 
-/* $Id: Smarty.class.php,v 1.436 2003/08/11 15:55:39 mohrt Exp $ */
+/* $Id: Smarty.class.php,v 1.437 2003/08/13 16:37:12 messju Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -2034,8 +2034,11 @@
      * wrapper for include() retaining $this
      * @return mixed
      */
-    function _include($filename, $once=false)
+    function _include($filename, $once=false, $vars=null)
     {
+        if (is_array($vars))
+            extract($vars, EXTR_PREFIX_SAME, 'include_php_');
+
         if ($once) {
             return include_once($filename);
         } else {
@@ -2048,8 +2051,11 @@
      * wrapper for eval() retaining $this
      * @return mixed
      */
-    function _eval($code)
+    function _eval($code, $vars=null)
     {
+        if (is_array($vars))
+            extract($vars, EXTR_PREFIX_SAME, 'include_php_');
+
         return eval($code);
     }
     /**#@-*/
Index: smarty/libs/core/core.smarty_include_php.php
diff -u smarty/libs/core/core.smarty_include_php.php:1.6 smarty/libs/core/core.smarty_include_php.php:1.7
--- smarty/libs/core/core.smarty_include_php.php:1.6	Wed Jul 23 12:14:47 2003
+++ smarty/libs/core/core.smarty_include_php.php	Wed Aug 13 12:37:12 2003
@@ -26,22 +26,20 @@
     $_smarty_resource_type = $_params['resource_type'];
     $_smarty_php_resource = $_params['php_resource'];
 
-    extract($params['smarty_include_vars'], EXTR_PREFIX_SAME, 'include_php_');
-
     if (!empty($params['smarty_assign'])) {
         ob_start();
         if ($_smarty_resource_type == 'file') {
-            $smarty->_include($_smarty_php_resource, $params['smarty_once']);
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
         } else {
-            $smarty->_eval($_smarty_php_resource);
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
         }
         $smarty->assign($params['smarty_assign'], ob_get_contents());
         ob_end_clean();
     } else {
         if ($_smarty_resource_type == 'file') {
-            $smarty->_include($_smarty_php_resource, $params['smarty_once']);
+            $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']);
         } else {
-            $smarty->_eval($_smarty_php_resource);
+            $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']);
         }
     }
 }



-- 
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.