- install package
composer require fluid-adapter/symfony-fluid-bundle
- activate bundle
Add new FluidAdapter\SymfonyFluidBundle\FluidBundle() to the Bundles in the app\AppKernel.php
- add fluid template engine
Add fluid to the framework.templating.engines array in app/config/config.yml
You can simply use the built-in render method in the controller to render a fluid template like this:
return $this->render('Default/Index.html', [
'foo' => 'bar'
]);
Templates are loaded from app/Resources/views/Templates/, app/Resources/views/Layouts/ and app/Resources/views/Partials/
| render argument | template path |
|---|---|
| AppBundle:Blog:Index | AppBundle/Resources/views/Templates/Blog/Index.html |
| Default/Index.html | app/Resources/views/Templates/Default/Index.html |