[PHPTAL] metal:define-slot, fill-slot, and macros

Eric Brown cephelo at gmail.com
Wed Nov 2 03:48:20 CET 2005


Based on the PHPTAL manual, I should be able to do the following:

--- file.htm ---
<div metal:fill-slot="content">
  Today... .. ...
</div>

<html metal:use-macro="base.htm/column" />

--- base.htm ---
<div metal:define-macro="column">
  <div metal:define-slot="content">
    Content will come here
  </div>
</div>

right? As far as I know, this worked fine in a prior version (or
something similar worked). Now the code that calls the macro in the
generated file.htm file is surrounded by:

$ctx->pushSlots();   and   $ctx->popSlots();

which effectively clear $ctx->_slots for the macro inclusion and
restore it after the macro is done. Doesn't that defeat the purpose of
slots across multiple templates?

If I remove (or comment out) the functionality of Context::pushSlots()
and Context::popSlots() it works as I expect.

I generally try to abstain from modifying good source packages -- is
there a reason it behaves this way, or am I doing something wrong?

Thanks.



More information about the PHPTAL mailing list