For the sake of clarity I should perhaps also note this - using the
event handler you will only get access to the parameters you
explicitly set in the actions, not the actual sf_content (which holds
the html of the rendered template).

On Sep 11, 3:59 pm, aalexand <[email protected]> wrote:
> Hi,
>
> $sf_content is stored in the attribute holder of the rendered view
> rather than the request.
>
> as far as I can see the use of the sfView object is local to the
> sfRenderingFilter, which means that you cannot access the appropriate
> attributeHolder directly from any other than the sfExecutionFilter.
>
> Anyway, you can store the model data in a second variable by providing
> a custom event handler for the 'template.filter_parameters' event,
> e.g.
>
> public function execute($filterChain)
> {
>     // beginning of the filter
>     $this->dispatcher->connect('template.filter_parameters', array
> ($this, 'copyTemplateParameters'));
>
>     // execute filter chain
>     $response = $this->context->getResponse();
>
>     // access the filtered parameters
>     $parameter = $this->attributeHolder->get
> ('some_template_parameter_name');
>
> }
>
> public funciton copyTemplateParameters(sfEvent $event, $content)
> {
>     // store references to the content in a local sfParameterHolder
> object
>     $this->attributeHolder = new sfParameterHolder();
>     $this->addByRef($content);
>
> }
>
> Cheers!
> Alex
>
> On Sep 11, 12:29 pm, Cyril G <[email protected]> wrote:
>
> > Hye,
>
> > I would like to get the $sf_content variable of layout.php in a
> > filter.
> > I tried with $this->getRequest()->getAttributeHolder()->get
> > ('sf_content') but it's always NULL, and I don't want $this-
>
> > >getResponse()->getContent().
>
> > Is this possible ?
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to