Hi,

I have a problem related to macros / slots again:

Imagine this macro, used to render a fieldset:
<tal:block metal:define-macro="fieldset">
        <fieldset>
                <legend><tal:block metal:define-slot="legend" /></legend>
                <tal:block metal:define-slot="content" />
        </fieldset>
</tal:block>

Use it nestedly:
<form>
        <tal:block metal:use-macro="fieldset">
                <tal:block metal:fill-slot="legend">First Level</tal:block>
                <tal:block metal:fill-slot="content">
                        <tal:block metal:use-macro="fieldset">
                                <tal:block metal:fill-slot="legend">Second 
Level</tal:block>
                                <tal:block metal:fill-slot="content">
                                        <label>Question</label><input 
type="text" name="question" />
                                </tal:block>
                        </tal:block>
                        <input type="submit" value="Send" />
                </tal:block>
        </tal:block>
</form>

What I would expect is:
<form>
        <fieldset>
                <legend>First Level</legend>
                <fieldset>
                        <legend>Second Level</legend>
                        <label>Question</label><input type="text" 
name="question" />
                </fieldset>
                <input type="submit" value="Send" />
        </fieldset>
</form>

But the result is:
<form>
        <fieldset>
                <legend>Second Level</legend>
                <fieldset>
                        <legend>Second Level</legend>
                        <label>Question</label><input type="text" 
name="question" />
                </fieldset>
                <input type="submit" value="Send" />
        </fieldset>
</form>

As you can see the slot "legend" gets overwritten by the lower one.

As far as I can see, this is a Beta problem only, that was introduced while 
enabling "Slot Inheritance".
It can be fixed by stripping out the Lines 218 - 221 and 228 - 230 in 
PHPTAL/Context.php. Interestingly these lines are commented with:
"setting slots in any context (probably violates TAL, but works around bug with 
tal:define popping context after fillslot)"

Well, setting slots in any context probably not only violates TAL but 
overwrites equal slots in ancestor contexts :)

Kind regards,
Per
 
--

webfactory GmbH
Per Bernhardt, Anwendungsentwickler

Lessingstraße 60
53113 Bonn
Germany

Fon +49 228 9114455
Fax +49 228 9114499
www.webfactory.de
p...@webfactory.de

Geschäftsführer: Sebastian Kugler, Matthias Pigulla
Handelsregister: HRB 8673, Amtsgericht Bonn


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

Reply via email to