[limb-svn] r6985 - in 3.x/trunk/limb/macro: src/tags/core tests/cases/tags/core

svn at limb-project.com svn at limb-project.com
Wed May 7 21:15:06 MSD 2008


Author: pachanga
Date: 2008-05-07 21:15:06 +0400 (Wed, 07 May 2008)
New Revision: 6985
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6985

Modified:
   3.x/trunk/limb/macro/src/tags/core/insert.tag.php
   3.x/trunk/limb/macro/tests/cases/tags/core/lmbMacroWrapTagBCTest.class.php
Log:
-- making static includes counter a class variable

Modified: 3.x/trunk/limb/macro/src/tags/core/insert.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/core/insert.tag.php	2008-05-06 08:00:23 UTC (rev 6984)
+++ 3.x/trunk/limb/macro/src/tags/core/insert.tag.php	2008-05-07 17:15:06 UTC (rev 6985)
@@ -18,6 +18,7 @@
  */
 class lmbMacroInsertTag extends lmbMacroTag
 {
+  protected static $static_includes_counter = 0;
   protected $is_dynamic = false;
 
   function preParse($compiler)
@@ -127,11 +128,9 @@
       parent :: _generateContent($code);
     else
     {
-      static $counter = 1;
-  
       list($keys, $vals) = $this->attributesIntoArgs();
   
-      $method = $code->beginMethod('__staticInclude' . ($counter++), $keys);
+      $method = $code->beginMethod('__staticInclude' . (++self :: $static_includes_counter), $keys);
       parent :: _generateContent($code);
       $code->endMethod();
   

Modified: 3.x/trunk/limb/macro/tests/cases/tags/core/lmbMacroWrapTagBCTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/tags/core/lmbMacroWrapTagBCTest.class.php	2008-05-06 08:00:23 UTC (rev 6984)
+++ 3.x/trunk/limb/macro/tests/cases/tags/core/lmbMacroWrapTagBCTest.class.php	2008-05-07 17:15:06 UTC (rev 6985)
@@ -278,5 +278,20 @@
     $out = $macro->render();
     $this->assertEqual($out, '<body>Main: <p>Numbers: <b>1</b> <u>2</u></p>  Extra: Wow!</body>');
   }
+
+  function testIncludeAfterSlot()
+  {
+    $layout = 'Slot:{{slot id="content"/}} Include:{{include file="include.phtml"/}}';
+    $content = '{{wrap with="layout.phtml" into="content"}}Hi!{{/wrap}}';
+    $include = "Bob";
+
+    $layout_tpl = $this->_createTemplate($layout, 'layout.phtml');
+    $content_tpl = $this->_createTemplate($content, 'content.phtml');
+    $include_tpl = $this->_createTemplate($include, 'include.phtml');
+
+    $macro = $this->_createMacro($content_tpl);
+    $out = $macro->render();
+    $this->assertEqual($out, 'Slot:Hi! Include:Bob');
+  }
 }
 



More information about the limb-svn mailing list