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):
        <table metal:define-macro="calendarMonthGrid">
                        <tal:block tal:repeat="currentDay days">
metal:define-slot="calendarDayContent" />

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

All help appreciated :D


PHPTAL mailing list

Reply via email to