template twig not found

twigerrorloadererror: template is not defined
drupal 8 include twig template
twig include
custom twig template
drupal 8 preprocess twig template
create a custom twig template drupal 8
drupal twig include template with variables
how to create a twig file in drupal 8

I have a problem with a render function in my controller.

I have:

  • a bundle, named CoreBundle
  • a controller named DefaultController
  • in which I have an action named loginAction
  • in which I am trying to render a template twig with this line

return $this->render('FooCoreBundle::Default:layout.html.twig', array());

I am always having the same not found error for the template. I have tried with an other template twig it is the same problem. In my views folder I have a Accueil folder in which i have put the login.html.twig template I want to render.

I tried to replace it directly in views folder but no changes. Sorry for my english hope you can help. Thank You.

Error when a template is not found via an "include" is confusing , twig" is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "footer.html.twig" in the Drupal theme registry.)  Twig - The flexible, fast, and secure template engine for PHP

You should use

 return $this->render('NeobeCoreBundle:Default:Accueil:layout.html.twig', array());

No double colon, add the Accueil subfolder

Twig for Developers - Documentation - Twig, This chapter describes the API to Twig and not the template language. This loader can find templates in folders on the file system and is the preferred way to​  template twig not found. Ask Question Asked 5 years, 3 months ago. The controller has no relevance in the twig template name. – qooplmao Jan 19 '15 at 19:39.

It is not really an answer, but it could be handy for those who arrives here with symfony 4.

In documentation authors says do not organize your business logic into bundles.

In modern Symfony applications, it's no longer recommended to organize your business logic using bundles.

Of course you can, just not recommended. See here.

404 – Not Found from _entry.twig templates in subdirectories, Templates or folder with an underscore are private and can't be accessed via template routing. Remove the _ and you are fine. For example  You can mark an include with ignore missing in which case Twig will ignore the statement if the template to be included does not exist. It has to be placed just after the template name. It has to be placed just after the template name.

Unable to find template · Issue #538 · sensiolabs , twig work now there is no Resource folder in the config? I just get cannot find. I also do not get how XXBundle:Namespace:file works either since  When the template system evaluates this template, first it locates the parent. The extends tag should be the first tag in the template. Note that since the child template doesn’t define the footer block, the value from the parent template is used instead. You can’t define multiple block tags with the same name in the same template. This

Twig doesn't show anything · Issue #67 · slimphp/Twig-View · GitHub, I'm using the twig view helper and it does not show anything. GitHub is home to over 50 million developers working together to host and review code, app/ cache/ templates/ home.twig src/ App.php Twig.php Home.php  When looking for a template, Twig tries each loader in turn and returns as soon as the template is found. When rendering the index.html template from the above example, Twig will load it with $loader2 but the base.html template will be loaded from $loader1. You can also add loaders via the addLoader () method. Create your own Loader ¶

Twig tutorial - creating PHP templates with Twig, Twig tutorial shows how to use Twig template engine in PHP some Twig tag, we would need not to parse a piece of the demonstration. I have the same problem that issue #24. In my twig template I have: The image is a field of entity User: /** * @ORM\Column(type="string", length=255,

Comments
  • Use `FooCoreBundle:Accueil:login.html.twig'. The controller has no relevance in the twig template name.
  • Thank u for your answers, i have tried : bundle:directory:filename => return $this->render('NeobeCoreBundle:Accueil:login.html.twig', array()); but i have this error : "NeobeAccueilBundle" does not exist or it is not enabled. It conisders Accueil as a bundle and not as folder. As mulder says, the truth is somewhere else.
  • Please, post the route to your template, f.i src/Foo/CoreBundle/Resources/views/Default/layout.html.twig and I'll try to provide and explanation and a correct symfony path
  • Thank you everybody, the mistake was in the login.html.twig file when i tried to insert css files i wrote '@NeobeAccueilBundle/Resources/public/css/bootstrap.min.css' that explain the error "NeobeAccueilBundle" does not exist or it is not enabled. it was true accueilBundle does not exist anymore copy and paste mistake. Sorry and thank u for your help.
  • Thank u for your answer but it still tells me : Unable to find template "FooCoreBundle:Default:Accueil:login.html.twig".
  • Please read carefully error messages: the name of the bundle is different.