PHP Nette - how specify latte file in presenter for render (like Symfony)
Hi,
is it possible to specify in PHP Nette what kind of latte file I want to render as it is done in Symfony in the controller? Ie.:
That would be nice, because I wouldn't have to create clouds of the same latte file for each render / action. Thanks
Hi,
it is possible to specify in PHP Nette what kind of latte file I want to render, as is done in the Symfony controller. This can be done like this:
is it possible to specify in PHP Nette what kind of latte file I want to render as it is done in Symfony in the controller? Ie.:
$this->render('admin/update.html.twig')
That would be nice, because I wouldn't have to create clouds of the same latte file for each render / action. Thanks
REPLY
Hi,
it is possible to specify in PHP Nette what kind of latte file I want to render, as is done in the Symfony controller. This can be done like this:
$this->template->setFile(__DIR__.'/templates/Admin/update.latte');
mám $content = '<section class="py-0 mt-5">
<h1 n:block="title">{$entity->getName()}</h1>
<div class="">
#{$entity->getId()} |
</div>
</section>'
když použiju:
$latte->renderToString($content, $presenterParams);
tak mám chybu:
LogicException
Missing template '/srv/app/templates/@layout.latte'.
Přitom soubor '/srv/app/templates/@layout.latte' na 100% existuje.
Dám ls '/srv/app/templates/@layout.latte' a vrací to ok.
Co by s touto nesmyslnou chybou šlo udělat? Díky