ignatenkovnikita / yii2-template-messages
带有占位符的模板消息
v1.0
2017-06-27 21:30 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-08-29 04:25:29 UTC
README
带有占位符的模板消息
安装
安装此扩展的首选方式是通过 Composer。
运行以下命令之一:
php composer.phar require --prefer-dist ignatenkovnikita/yii2-template-messages "*"
或者在您的 composer.json
文件的 require 部分添加
"ignatenkovnikita/yii2-template-messages": "*"
。
用法
扩展安装完成后,只需在代码中使用它即可
'modules'=>[ 'template' => [ 'class' => 'ignatenkovnikita\template\Module', ], ],
代码中使用示例
Template::replace('template_name', [ 'your_variable' => 'value ]);
在迁移中添加示例
$rows = [ [ 'promo-code-send', 'Отправка купона пользователю', '["promo_code"]', 'Трэк {promo_code}' ], ]; $this->batchInsert('{{template}}', ['id', 'title', 'placeholders', 'message'], $rows); $this->update('{{%template}}',['widget_options' => '{"toolbar":false,"pastePlainText":true,"buttonSource":true,"paragraphize":false}']);
应用迁移
./console/yii migrate --migrationPath=vendor/ignatenkovnikita/yii2-template-messages/migrations/
待办事项
- 添加支持邮箱
- 重构