Pablo Ruiz Ortega Pablo Ruiz Ortega - 10 months ago 495
Twig Question

Unable to find template symfony3

I'm doing a project as a web dev student on symfony3.
I've been looking for similar errors, but i cant get the solution for mine.
I have a problem when im trying to load a twig template, the error is the next one:


Unable to find template "ForoBundle:Usuario:prueba.html.twig" (looked into: D:\xampp\htdocs\dawSymfony\app/Resources/views, D:\xampp\htdocs\dawSymfony\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form)


I dont get it, can you help me out?

My routes:

foro_homepage:
path: /foro
defaults: { _controller: ForoBundle:Default:index }


foro_prueba:
path: /prueba
defaults: { _controller: ForoBundle:Default:prueba }


My action:

public function pruebaAction(){
return $this->render("@Foro:Usuario:prueba.html.twig");

}


Structure

Answer Source

Your code should look like that:

$this->render("@Foro/Usuario/prueba.html.twig");

Check the doc.

You should be using slashes and bundle name without word "Bundle".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download