Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing template render result to another method

Tags:

php

symfony

i'm trying to assign $this->render() result to a method (this method renders google map's infoWindow/baloon).

I'm using method like this to create this infoWindow:

$infoWindow->setContent(<here goes the template>);

but passing it like this:

$infoWindow->setContent($this->render('WmapFrontBundle:Place:infoWindow.html.twig'));

don't work at all. What's the proper way to assign template to a variable or pass it's content to a method ?

like image 692
mbajur Avatar asked Dec 27 '22 14:12

mbajur


1 Answers

Use renderView(), it returns the rendered template only.

render() returns a Response object (with the rendered template, headers, etc).

like image 168
Arnaud Le Blanc Avatar answered Jan 05 '23 10:01

Arnaud Le Blanc