Hi,
we are working on a Symfony2 based project where we have an external
definition which content modules
to add on each page generated by template. For accomplishing this we are
using a tree structure where each node is
mapped to a symfony controller/template.
Therefore a typical template looks like this:
<h1>{{ headline }}</h1>
<h2>{{ introduction }}</h2>
{% for subNode in subNodes %}
{% renderContent subNode %}
{% endfor %}
*renderContent *is a twig extension which determines the controller to use
and fills the parameter array
based on the contents of the subNode object. All this information is
retrieved from the page description
itself and from the configuration (e.g. for determining which controllers to
use). Then the standard
render method is called.
If one of the controllers needs to access request parameters (GET/POST),
e.g. to get the value of a
"page" parameter for paging a slide show contained in one module on the
page, there is currently no
official way to access these parameters if they weren't handed down from the
top level controller to
all sub controllers. This is done to be able to use ESI as far as I
understand (since you need to be
able to know all variable values to diffentiate between different
incarnations of the same template).
Passing down specifically the request parameters needed in a sub-controller
from the template one or more
levels above is not possible since we don't know which parameters will be
needed. Passing down all
parameters creates an unnecessary overhead and prevents using the cache
efficiently.
How about introducing a configuration which allows to define which request
parameters are needed in
a given controller? This way you could define "FooBar:ImageGallery:show
needs page parameter from
request". Then controller would now be able to access the "page" parameter.
And the ESI layer
knows that the "page" parameter needs to be tracked additionally when
building the cache key.
Or are there other solutions for solving this problem?
Regards,
Sven
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en