On 18-09-2009 at 10:50:30 GRolf ger...@pictureparking.com wrote:
I'm doing a
div tal:repeat=item items
Previous id: ???
Current id: ${item/id}
Next id: ???
/div
Is there any way to add a callback function that will be called on
each repeat, so I could easily put the next and previous id ?
I could loop through the array in PHP, before assigning to PHPTal
object, and set them. But that would mean looping through the array
twice (once before, once for output)...
If array is numerically indexed, then this will work:
tal:define=prev items/${php:repeat.item.index - 1}/id | nothing; next
items/${php:repeat.item.index + 1}/id | nothing
RepeatController reads one item ahead and could store previous item, so if
you're willing to change PHPTAL's code, it's possible to easily add
something like repeat.item.next/repeat.item.prev.
--
regards, Kornel
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal