#1110: Allow array syntax for slot names
-------------------------+--------------------------------------------------
Reporter: david | Owner: david
Type: enhancement | Status: new
Priority: normal | Milestone: 1.1
Component: view | Version:
Severity: normal | Keywords:
Has_patch: 0 |
-------------------------+--------------------------------------------------
It would be nice if you could do sth like:
{{{
#!php
<?php
foreach($comments as $comment) {
$layer->setSlot(sprintf('comments[%d]', $comment->getId()),
$comment->witchcraft());
}
?>
}}}
This has been on my list of things to add for a long time, but #1109
reminded me that there remains a strong use case for it, so we should add
it. In a template, you could of course then do:
{{{
#!php
<?php
foreach($slots['comments'] as $comment):
// ...
endforeach;
?>
}}}
We can just use literal strings as slot names and expand the array syntax
at the time where we assign the results of the slot execution (i.e. the
slot's response content) to the {{{$slots}}} array. That's best for BC, as
the {{{setSlot()}}} signature requires an
{{{AgaviExecutionContainer}}} instance as the second arg, and storing the
expanded array right in a layer's {{{$slots}}} array, we'd have to allow
arrays as the second arg as well.
--
Ticket URL: <http://trac.agavi.org/ticket/1110>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets