DQNEO / smarty-delimiter-converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Smarty Delimiter Converter

Build Status

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/

About

License:GNU Lesser General Public License v3.0


Languages

Language:PHP 75.8%Language:Smarty 24.2%