cvs: smarty /libs Smarty.class.php Smarty_Compiler.class.php /libs/core core.smarty_include.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1059467182@cvsserver>
messju		Tue Jul 29 04:26:22 2003 EDT

  Removed files:               
    /smarty/libs/core	core.smarty_include.php 

  Modified files:              
    /smarty/libs	Smarty.class.php Smarty_Compiler.class.php 
  Log:
  moved _smarty_include() back into Smarty.class.php
  
  
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.424 smarty/libs/Smarty.class.php:1.425
--- smarty/libs/Smarty.class.php:1.424	Tue Jul 29 03:15:43 2003
+++ smarty/libs/Smarty.class.php	Tue Jul 29 04:26:22 2003
@@ -42,7 +42,7 @@
  * @version 2.5.0-cvs
  */
 
-/* $Id: Smarty.class.php,v 1.424 2003/07/29 07:15:43 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.425 2003/07/29 08:26:22 messju Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -1937,6 +1937,60 @@
         $_ret = ob_get_contents();
         ob_end_clean();
         return $_ret;
+    }
+
+
+    /**
+     * called for included templates
+     *
+     * @param string $_smarty_include_tpl_file
+     * @param string $_smarty_include_vars
+     */
+    
+    // $_smarty_include_tpl_file, $_smarty_include_vars
+    
+    function _smarty_include($params, &$smarty)
+    {
+        if ($smarty->debugging) {
+            $_params = array();
+            require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
+            $debug_start_time = smarty_core_get_microtime($_params, $smarty);
+            $smarty->_smarty_debug_info[] = array('type'      => 'template',
+                                                  'filename'  => $params['smarty_include_tpl_file'],
+                                                  'depth'     => ++$smarty->_inclusion_depth);
+            $included_tpls_idx = count($smarty->_smarty_debug_info) - 1;
+        }
+
+        $smarty->_tpl_vars = array_merge($smarty->_tpl_vars, $params['smarty_include_vars']);
+
+        // config vars are treated as local, so push a copy of the
+        // current ones onto the front of the stack
+        array_unshift($smarty->_config, $smarty->_config[0]);
+
+        $_smarty_compile_path = $smarty->_get_compile_path($params['smarty_include_tpl_file']);
+
+
+        if ($smarty->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
+            || $smarty->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
+        {
+            include($_smarty_compile_path);
+        }
+
+        // pop the local vars off the front of the stack
+        array_shift($smarty->_config);
+
+        $smarty->_inclusion_depth--;
+
+        if ($smarty->debugging) {
+            // capture time for debugging info
+            $_params = array();
+            require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
+            $smarty->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $smarty) - $debug_start_time;
+        }
+
+        if ($smarty->caching) {
+            $smarty->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
+        }
     }
 
 
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.265 smarty/libs/Smarty_Compiler.class.php:1.266
--- smarty/libs/Smarty_Compiler.class.php:1.265	Mon Jul 28 16:36:55 2003
+++ smarty/libs/Smarty_Compiler.class.php	Tue Jul 29 04:26:22 2003
@@ -39,7 +39,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.265 2003/07/28 20:36:55 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.266 2003/07/29 08:26:22 messju Exp $ */
 
 /**
  * Template compiling class
@@ -881,8 +881,7 @@
 		
 		
 		$_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))";
-	
-		$output .= "require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.smarty_include.php');\nsmarty_core_smarty_include($_params, \$this);\n" .
+		$output .= "\$this->_smarty_include($_params, \$this);\n" .
         "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
         "unset(\$_smarty_tpl_vars);\n";
 



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