dqneo / smarty-delimiter-converter
a cli tool to convert delimiters in smarty template files
v0.0.3
2016-02-10 18:01 UTC
Requires (Dev)
- phpunit/phpunit: 4.*
- smarty/smarty: 2.*
This package is auto-updated.
Last update: 2024-12-07 03:21:13 UTC
README
convert tool to replace delimiters (e.g. from {
}
to {{
}}
) in your smarty template files.
DESCRIPTION
It converts the content
{if $config.smarty_debug}
{debug}
{/if}
into this
{{if $config.smarty_debug}}
{{debug}}
{{/if}}
You can customize delimiters as you like.
INSTALL
composer require dqneo/smarty-delimiter-converter
USAGE
use DQNEO\SmartyDelimiterConverter\Converter; // define delimiters $from = ['{', '}']; $to = ['{{', '}}']; $converter = new Converter($from, $to); // convert a content $converted = $converter->convert('hello {$name}'); // => 'hello {{$name}}' # convert a file $converted = $converter->convert('/path/to/file.tpl'); // returns a converted content
you can convert all template files under a directory recursivlely
./bin/smarty-delimiter-converter /path/to/dir/