Is there a way to put the html code from a twig template into a html file. I mean, in this case
$html = $this->render('SiteBundle:Generated:home_news.html.twig', array('news' => $news))->getContent();
Is there a way where I can do this?
$html->output($html_file);
And it gerenates a html file with the template.
I'm doing this because I have news from a wordpress blog and I want to show the latest news in the homepage. So I would want to put the news of my site in a static file to avoid to generate it with each home request.
If you check documentation more carefully, you'd find this chapter, which says:
$content = $this->renderView('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With