dqneo / smarty-delimiter-converter
一个用于转换smarty模板文件分隔符的命令行工具
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-09-07 02:53:37 UTC
README
转换工具,用于替换你的smarty模板文件中的分隔符(例如从{
}
到{{
}}
)。
描述
它将内容
{if $config.smarty_debug}
{debug}
{/if}
转换成这样
{{if $config.smarty_debug}}
{{debug}}
{{/if}}
你可以按需自定义分隔符。
安装
composer require dqneo/smarty-delimiter-converter
使用方法
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
你可以递归地转换目录下的所有模板文件
./bin/smarty-delimiter-converter /path/to/dir/