Closed michalbundyra closed 6 years ago
I've checked how it works with twig (on zend-expressive). There in layout we have access to all variables - from template and shared.
👍
I've checked how it works with twig (on zend-expressive). There in layout we have access to all variables - from template and shared.
Same for plates. You can set variables for a single template or all templates, including layouts.
@webimpress actually i've done things like this in plates prior and other ways... the biggest question that I have when you start to explode the scope like this is how does this work with partials? More or less, how is the scope contained? AKA please add a test for scope containment :)
@mwillbanks The scope is contained as the variables are present:
In all other situations, you would need to inject them directly when calling partial()
, render()
, etc.
Thanks, @webimpress!
I think shared default parameters should be available in layout. Currently these are available only in template. I know that we can access them using:
but it is not convenient at all...
I can't see any other way currently to set some layout params. Am I missing something?
The other solution for me will be possibility to set variables only for view, something like:
Or maybe we should have both? Shared variables visible in layout directly (as I have done in PR) and possibility to set variables only for layout?