Reputation: 295
I am new in Symfony3, I used Twig to render a template and all was fine, but when I wanted to switch to PHP rendering I got error:
My class :
class Testdb extends Controller
{
/**
* @Route("/testdb")
*
*/
public function testing()
{
//return $this->render('testdb.html.twig',array('result'=>$result));
return $this->render('testdb.html.php',array('result'=>$result));
}
}
I put my testdb.html.php in app/Resources/views/ and I edited my config.yml :
templating:
engines: ['twig','php']
The when I browse ttp://127.0.0.1:8000/testdb
I get The template "testdb.html.php" does not exist
Upvotes: 0
Views: 282
Reputation: 766
You need to render the template, which is inside your application, or at least, specify in which bundle/app your template is.
return $this->render(
'AppBundle:Default:testdb.html.php',
array('result'=>$result)
);
Where AppBundle is the name of your app, and Default is the directory where is located your tempalte.
Upvotes: 2