Hi Guys,

I'm trying to build an ajax application and am running into troubles
with ESI. Here's a simple version of what I'm trying to do:

4 content areas:
- Header
- Footer
- Sidebar
- Content

When a link is clicked, an ajax request is fired that gets the content
and updates the relevant page areas.

In my controller:

// If it's an ajax request, return a JSON structure with the seperate
page parts to update.
if ($request->isXmlHttpRequest())
        {
            $result = array();
            $result['title'] = $title;
            $result['page_header'] = $templating-
>render('LimelightBundle:Core:home_header.html.twig');
            $result['page_content'] = $templating-
>render('LimelightBundle:Core:home_content.html.twig');
            $response = new Response(json_encode($result));
            $response->headers->set('Content-Type', 'application/
json');
            return $response;
        }

// Else it's a normal request, return the full response.
        return $this->container->get('templating')-
>renderResponse('LimelightBundle:Core:home.html.twig', array('title'
=> $title), $response);

As you can see, I'm trying to return a JSON object with the relevant
properties filled with the relevant page sections. Now, in the
home_content.html.twig template I call a few ESI tags. They work fine
on a regular page load, but do not work when I try to use the method
above to return parts of the page via JSON.

It simply returns the json structure with the <esi src="" /> tags
without replacing the ESI tags with their actual content.

Any thoughts on how to fix this or the best way to go about doing
this? If anyone needs any clarification please let me know.

Thanks!
Marc

-- 
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