Can I include PHP templates in a basic TWIG template or vice versa?

I am currently in the process of reorganizing and restructuring an existing Symfony 2 application.

There are several basic templates, and all other templates are inherited from them. Now all the templates are PHP. I plan to port the application to TWIG.

The problem is that this application is already in use, and during the migration I also have to add new features to the application. This means that I can not freeze the current state of the application, completely switch to TWIG and continue working with it.

This means that the transition to TWIG is possible only in small steps, i.e. I can only migrate a few templates before I have to deploy a new version. New templates will also be added for added features, and I would also like to add them to the TWIG format.

Now I plan to first migrate the base templates to TWIG, and then add the existing PHP templates to these new base templates. Subsequently, I will continue to transfer other templates in small batches.

When looking at online documentation, you can use the PHP and TWIG template engines at the same time. However, I could not find any textbooks, examples or documentation that mentioned that you can not only have these two mechanisms next to each other, but also have templates from one engine, including templates from another engine.

, ?

+4
1

( ), -, .

, , / .

:

  • php
  • -

, , , php .

+4

All Articles