-
Notifications
You must be signed in to change notification settings - Fork 195
Adding parameters to templates before render-time #142
Comments
Twig has an |
@akrabat - I missed that when we were updating the twig implementation.
|
Looking at how zend-expressive-zendview is implemented, I'd say that the way the Twig one is done is correct as this way we have per-template default parameters which isn't supported by Twig's However, I don't see a way to add a parameter to every template as per the example in this issue? |
Ah - there's a weird template name called "TEMPLATE_ALL"… I would never have guessed that! |
Evidently I need to make that more prominent in the docs... Any suggestions? We could still have that proxy to twig's global, while providing the
|
Closed with #143 |
Consistency in `composer serve` invocation. See [zend-expressive-skeleton #142](https://github.com/organization/project/pull/142) for details.
Consistency in `composer serve` invocation. See [zend-expressive-skeleton #142](https://github.com/organization/project/pull/142) for details.
Right now we've only got one chance to add parameters to templates, via
render($name, $params)
.However it'd be really useful to add data in stages. So a piped middleware could be responsible for populating standard stuff like the current user's name, then the routed middleware adds the stuff it's responsible for.
Plates offers addData() that does just this. From what I can tell it's possible in Zend View as well. Twig doesn't, but it could be faked easily enough by storing the data in the Twig bridge until render time.
Anyone else think this is good idea?
The text was updated successfully, but these errors were encountered: