omegacode/symfony-fluid-integration

将模板引擎 fluid 集成到 symfony 4 项目中。

安装: 69

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

类型:symfony-bundle

0.7.0 2018-12-16 20:26 UTC

This package is auto-updated.

Last update: 2024-09-20 05:21:14 UTC


README

! 目前此项目正在开发中。 !

描述

将模板引擎 fluid 集成到 symfony 4 项目中。

设置

打开文件 config/services.yaml 并添加以下内容

services:
  templating.engine.fluid:
    public: true
    autowire: true
    class: OmegaCode\FluidIntegration\FluidEngine
    arguments:
    - '@kernel'
    - '@omega_code_fluid_integration.settings'

接下来,打开文件 config/packages/framework.yaml 并添加以下内容

framework:
  templating:
    engines: ['fluid', 'twig', 'php']

最后,打开文件 config/bundles.php 并添加该包

<?php
return [
    ...
    OmegaCode\FluidIntegration\OmegaCodeFluidIntegrationBundle::class => ['all' => true],
    ...
];

现在您可以在控制器中渲染 fluid 模板

class DemoController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{
    public function indexAction()
    {
        return $this->render('demo/index.html', [
            'var' => 'val'
        ]);
    }
}

视图助手 - 为您的 IDE 自动完成

为了在 IDE 中启用自定义 symfony-fluid-integration 视图助手的自动完成,请添加以下 URL:http://omega-code.de/ViewHelperSchemas/schema.xsd