schranz-templating/symfony-smarty-integration

通过 Smarty 模板引擎将模板渲染器集成到 symfony 中。

0.1.0 2022-09-17 15:53 UTC

This package is auto-updated.

Last update: 2024-08-29 06:16:37 UTC


README

将模板适配器 Smarty Adapter 集成到 Symfony 框架中。

Schranz Templating Project 的一部分。

安装

通过 Composer 安装此包

composer require schranz-templating/symfony-smarty-integration

在您的 config/bundles.php 或 Kernel 文件中注册 Bundle 类

return [
    // ...
    Schranz\Templating\Integration\Symfony\Smarty\SchranzTemplatingMustacheBundle::class => ['all' => true],
];

配置

Smarty 集成提供了以下配置选项:

schranz_templating_smarty:
    default_path: '%kernel.project_dir%/templates'
    cache: '%kernel.cache_dir%/smarty'

不需要任何配置。

default_path

类型: string 默认: '%kernel.project_dir%/templates'

默认情况下,Symfony 将在此目录中查找应用程序的 Smarty 模板。

cache

类型: string 默认: '%kernel.cache_dir%/smarty'

在将 Smarty 模板编译成常规 PHP 代码以进行渲染之前,它们被缓存在此配置选项定义的目录中。编译是一个耗时的过程,因此结果被缓存以节省资源。