$this->container->get('request')->isXmlHttpRequest()

can also be shortened to $this->get('request')->isXmlHttpRequest()


On Feb 27, 1:58 pm, Christophe COEVOET <s...@notk.org> wrote:
> Le 27/02/2011 20:48, Christophe Beyer a crit :> Hello,
>
> > I want to display a template in two modes : the "normal" mode,
> > embedded in the main layout, and an ajax mode; without duplicate my
> > template of course.
>
> > 1. In my controller, how can I check if the requested url is an ajax
> > request (without adding any parameter) ?
>
> $this->container->get('request')->isXmlHttpRequest()
>
> > 2. In the Twig file, I tried to make this :
> > {% if ajax %}{% extends "MyBundle::layout.twig.html" %}{% endif %}
> > but it doesn't work.
>
> {% extends ajax ? "" : "MyBundle::layout.twig.html" %}
>
> Regards
>
> --
> Christophe | Stof

-- 
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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to