[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-cvs
Subject:    [PEAR-CVS] cvs: pear /Structures_DataGrid package2-r-smarty.xml  /Structures_DataGrid/DataGrid/Rende
From:       "Olivier Guilyardi" <olivierg () php ! net>
Date:       2007-10-31 19:46:20
Message-ID: cvsolivierg1193859980 () cvsserver
[Download RAW message or body]

olivierg		Wed Oct 31 19:46:20 2007 UTC

  Modified files:              
    /pear/Structures_DataGrid	package2-r-smarty.xml 
    /pear/Structures_DataGrid/DataGrid/Renderer	Smarty.php 
  Log:
  fix a bug which prevented smarty {debug} function from working because of a \
recursive reference  
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/package2-r-smarty.xml?r1=1.20&r2=1.21&diff_format=u
                
Index: pear/Structures_DataGrid/package2-r-smarty.xml
diff -u pear/Structures_DataGrid/package2-r-smarty.xml:1.20 \
                pear/Structures_DataGrid/package2-r-smarty.xml:1.21
--- pear/Structures_DataGrid/package2-r-smarty.xml:1.20	Wed Oct 31 16:56:24 2007
+++ pear/Structures_DataGrid/package2-r-smarty.xml	Wed Oct 31 19:46:20 2007
@@ -45,6 +45,8 @@
 - new columnSet item members: direction and onclick
 - Request #9994: add support for URL mapping, by Sascha Grossenbacher
 - add "Object Preserving" feature
+- fix a bug which prevented smarty {debug} function from working because of a 
+  recursive reference
  </notes>
  <contents>
   <dir name="/">
http://cvs.php.net/viewvc.cgi/pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php?r1=1.51&r2=1.52&diff_format=u
                
Index: pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php
diff -u pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.51 \
                pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.52
--- pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php:1.51	Wed Oct 31 16:56:25 \
                2007
+++ pear/Structures_DataGrid/DataGrid/Renderer/Smarty.php	Wed Oct 31 19:46:20 2007
@@ -36,9 +36,9 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * CVS file id: $Id: Smarty.php,v 1.51 2007/10/31 16:56:25 olivierg Exp $
+ * CVS file id: $Id: Smarty.php,v 1.52 2007/10/31 19:46:20 olivierg Exp $
  * 
- * @version  $Revision: 1.51 $
+ * @version  $Revision: 1.52 $
  * @package  Structures_DataGrid_Renderer_Smarty
  * @category Structures
  * @license  http://opensource.org/licenses/bsd-license.php New BSD License
@@ -127,7 +127,7 @@
  * records, you can access their properties and methods in your smarty template, 
  * with something like: {$recordSet[col]->getSomeInformation()}.
  *
- * @version  $Revision: 1.51 $
+ * @version  $Revision: 1.52 $
  * @example  smarty-simple.php Using the Smarty renderer
  * @example  smarty-simple.tpl Smarty template with sorting and paging \
                (smarty-simple.tpl)
  * @author   Andrew S. Nagy <asnagy@webitecture.org>
@@ -176,7 +176,7 @@
             )
         );
     }
-
+        
     /**
      * Attach an already instantiated Smarty object
      * 
@@ -322,12 +322,12 @@
                 $this->_smarty->assign($key, $val);
             }
 
-            $this->_smarty->assign_by_ref("{$p}datagrid", $this);
+            $this->_smarty->assign("{$p}datagrid", $this->_getReference());
 
             $this->_smarty->register_function("{$p}getPaging",
                 array(&$this, '_smartyGetPaging'));
         } else {
-            $this->_data["{$p}datagrid"] =& $this;
+            $this->_data["{$p}datagrid"] = $this->_getReference();
         }
     }
 
@@ -383,7 +383,7 @@
 
         // Use a different renderer if provided
         if (isset($params['datagrid'])) {
-            $renderer =& $params['datagrid'];
+            $renderer =& $this->_getReference($params['datagrid']);
             unset($params['datagrid']);
         } else {
             $renderer =& $this; 
@@ -395,6 +395,25 @@
     }
 
     /**
+     * Return a renderer reference by id or create a new id
+     *
+     * @param  int      Renderer id
+     * @return mixed    New id or renderer object
+     */
+    function &_getReference($id = null)
+    {
+        static $references = array();
+        
+        if (!is_null($id)) {
+            return $references[$id - 1];
+        } else {
+            $references[] =& $this;
+            $id = count($references);
+            return $id;
+        }
+    }
+
+    /**
      * Default formatter for all cells
      * 
      * @param string  Cell value 

-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic