robloach/templating-smarty

Smarty 模板组件对 Symfony 模板组件的支持。

dev-master 2014-11-04 05:24 UTC

This package is auto-updated.

Last update: 2024-09-10 09:01:36 UTC


README

Build Status Total Downloads Latest Stable Version

Smarty 提供对 Symfony 模板组件 的支持。

安装

可以使用 Composer 安装 Templating Smarty,将其作为项目 composer.json 文件中的依赖项添加。

{
    "require": {
        "robloach/templating-smarty": "*"
    }
}

有关更详细的安装和使用说明,请参阅 Composer 文档

使用方法

实例化引擎

use RobLoach\TemplatingExtras\SmartyEngine;

$parser = new Symfony\Component\Templating\TemplateNameParser();
$templating = new SmartyEngine($parser, array(
    'template_dir' => '.'
));

echo $templating->render('hello.smarty', array('firstname' => 'Fabien'));

hello.smarty

Hello, {$firstname}!

有关使用不同模板引擎的更多信息,请参阅 Symfony 模板组件文档