robloach/templating-smarty

Symfony Templating Component support for Smarty.

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

README

Build Status Total Downloads Latest Stable Version

Smarty support for Symfony's Templating component.

Installation

Templating Smarty can be installed with Composer by adding it as a dependency to your project's composer.json file.

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

Please refer to Composer's documentation for more detailed installation and usage instructions.

Usage

Instantiate the engine:

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}!

See Symfony's documentation on Templating for more information about using the different template engines available.