azettl/php-nano-template
Composer 安装命令:
composer require azettl/php-nano-template
包简介
The php-nano-template class replaces placeholders in a string with values from an array.
关键字:
README 文档
README
The php-nano-template class replaces placeholders in a string with values from an array.
Installation
composer require azettl/php-nano-template
Usage
$nano = new com\azettl\nano\template(); $nano->setTemplate( "<p> {user.greeting()} {user.function(2)} {user.function('test')} {user.first_name} {user.last name}! Your account is <strong>{user.account.status}</strong> {user.nonexistingnode} </p>" ); $nano->setData($aData); $nano->setShowEmpty(true); echo $nano->render();
or
$nano = new com\azettl\nano\template( "<p> {user.greeting()} {user.first_name} {user.last name}! Your account is <strong>{user.account.status}</strong> {user.nonexistingnode} </p>", [ "user" => [ "login" => "demo", "first_name" => "Anon", "last name" => "Ymous", "account" => [ "status" => "active", "expires_at" => "2016-12-31" ], "greeting" => function(){ return 'Hello'; }, "function" => function($param){ return 'Test' . $param; } ] ] ); echo $nano->render();
or
$nano = new com\azettl\nano\template(); $nano->setTemplateFile( "tests/template.html" ); $nano->setData($aData); echo $nano->render();
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-01