I really like to use partial templates in my symfony 1.4 projets and I was wondering if there is something like that with Twig in symfony 2.0.
It's way more clear and reusable to have something like that
<?php include_partial('forum/message', array('message'=>$message)); ?>
Rathen than a big portion of php/html code.
Twig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and maintained by Fabien Potencier. The initial version was created by Armin Ronacher.
Blocks are used for inheritance and act as placeholders and replacements at the same time. They are documented in detail in the documentation for the extends tag. Block names must consist of alphanumeric characters, and underscores. The first char can't be a digit and dashes are not permitted.
Twig Extensions allow the creation of custom functions, filters, and more to use in your Twig templates.
Yes. It's called include
in Twig. Details are in the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With