I got the following recursive structure :

<ul>
  <li metal:use-macro="menu_item">
    <tal:block metal:fill-slot="texte">File</tal:block>
    <tal:block metal:fill-slot="sous-menu">
      <ul>
        <li metal:use-macro="menu_item" tal:define="buggy string:">
          <tal:block metal:fill-slot="texte">Open</tal:block>
        </li>
      </ul>
    </tal:block>
  </li>
</ul>

<tal:block metal:define-macro="menu_item">
  <li class="menu_item">
    <a href="#"><tal:block metal:define-slot="texte" /></a>
    <tal:block metal:define-slot="sous-menu" />
  </li>
</tal:block>

Instead of
* File
  * Open

the result is :
* Open
  * Open

If I drop the tal:define="buggy string:", that works.
This behaviour is caused by Context::fillSlot, line 215 :

if ($this->_parentContext) {
  // setting slots in any context (probably violates TAL, but works around bug
with tal:define popping context after fillslot)
  $this->_parentContext->fillSlot($key, $content);
}

As I read the comment, the aim of this code piece is to allow using tal:define
on the same tag as metal:fill-slot.

I dropped this piece of code - I never use tal:define and metal:fill-slot in the
same time. But has anybody an idea of a proper solution, correcting the 2 bugs ?


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to