Hi all,

Just a quick one. Could someone tell me how to reference a variable defined 
within a metal macro from within a slot?

In particular, I'd like to define a macro that generates a calendar grid of 
days and then use a slot to provide varying content to be rendered within the 
'day' cells. I am trying to do this as a macro accepting an array and looping 
through the array content. This works fine but when I then try to split out the 
cell content into a slot, I receive errors that I can't access the current loop 
value (or, by my understanding, any other variables defined within the metal 
macro) from the slot.

A quick (very simplified) example...

The macro block (in macro.xhtml):
<tal:block>
        <table metal:define-macro="calendarMonthGrid">
                <thead>
                        <tr>
                                
<th>monday</th><th>tuesday</th><th>wednesday</th><th>thursday</th><th>friday</th><th>saturday</th><th>sunday</th>
                        </tr>
                </thead>
                <tbody>
                        <tal:block tal:repeat="currentDay days">
                                <td>
                                        <tal:block 
metal:define-slot="calendarDayContent" />
                                </td>
                        </tal:block>
                </tbody>
        </table>
</tal:block>



The main page and slot:
<tal:block tal:define="days monthDays" 
metal:use-macro="macro.xhtml/calendarMonthGrid">
        <div metal:fill-slot="dialogContent">
                <span tal:content="currentDay/someInterestingInfo" />   <----- 
this bit fails with an error regarding currentDay not being defined
        </div>
</tal:block>


All help appreciated :D

Robert



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

Reply via email to