In my Symfony2 project, I would like to get the HTML of a file and put it in a variable in my controller.
I have a controller function like this:
public function myControllerAction()
{
$htmlOtherFile = '';
return $this->render('@MyBundle/myTargetFile.html.twig', ['htmlOtherFile' => $htmlOtherFile]);
}
The html file I would like to import is in my views folder: htmlOtherFile.html.twig
How can I get the HTML of this file into my $htmlOtherFile variable? I have already tried with file_get_contents, but without success.