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

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1060256146@cvsserver>
messju		Thu Aug  7 07:35:46 2003 EDT

  Modified files:              
    /smarty/libs	Smarty.class.php Smarty_Compiler.class.php 
  Log:
  better caching of attributes for $cacheable=false-plugins
  
  
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.431 smarty/libs/Smarty.class.php:1.432
--- smarty/libs/Smarty.class.php:1.431	Wed Aug  6 07:35:58 2003
+++ smarty/libs/Smarty.class.php	Thu Aug  7 07:35:46 2003
@@ -43,7 +43,7 @@
  * @version 2.5.0-cvs
  */
 
-/* $Id: Smarty.class.php,v 1.431 2003/08/06 11:35:58 messju Exp $ */
+/* $Id: Smarty.class.php,v 1.432 2003/08/07 11:35:46 messju Exp $ */
 
 /**
  * DIR_SEP isn't used anymore, but third party apps might
@@ -1996,6 +1996,30 @@
         if ($smarty->caching) {
             $smarty->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
         }
+    }
+
+
+    /**
+     * get or set an array of cached attributes for function that is
+     * not cacheable
+     * @return array
+     */
+    function &_smarty_cache_attrs($cache_serial, $count) {
+        $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
+
+        if ($this->_cache_including) {
+            /* return next set of cache_attrs */
+            $_return =& current($_cache_attrs);
+            next($_cache_attrs);
+            return $_return;
+
+        } else {
+            /* add a reference to a new set of cache_attrs */
+            $_cache_attrs[] = array();
+            return $_cache_attrs[count($_cache_attrs)-1];
+
+        }
+
     }
 
 
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.272 smarty/libs/Smarty_Compiler.class.php:1.273
--- smarty/libs/Smarty_Compiler.class.php:1.272	Thu Aug  7 06:21:17 2003
+++ smarty/libs/Smarty_Compiler.class.php	Thu Aug  7 07:35:46 2003
@@ -39,7 +39,7 @@
  * @package Smarty
  */
 
-/* $Id: Smarty_Compiler.class.php,v 1.272 2003/08/07 10:21:17 messju Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.273 2003/08/07 11:35:46 messju Exp $ */
 
 /**
  * Template compiling class
@@ -1294,7 +1294,7 @@
             /* we have a list of parameters that should be cached */
             $_cache_attrs = $this->_plugins[$type][$name][5];
             $_count = $this->_cache_attrs_count++;
-            $cache_code = "\$_cache_attrs =& \$this->_cache_info['cache_attrs']['$this->_cache_serial'][$_count];";
+            $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');";
 
         } else {
             /* no parameters are cached */



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