kavalanche/template
Composer 安装命令:
composer require kavalanche/template
包简介
Simple templating system
README 文档
README
Simple templating system
Usage
Require kavalanche/template (composer)
composer require kavalanche/templateCreate instance of
Kavalanche\Template\Viewsomewhere in your front controller or other bootstrapping part of the code.// without default base view defined $view = new Kavalanche\Template\View('/path/to/templates'); // with default base view defined $view = new Kavalanche\Template\View('/path/to/templates', 'base');Pass
$viewto your controller or wherever you want.Invoke
rendermethod and pass variables to view file.public function index() { $list = [...]; // you can optionally override base view by passing third argument (e.g. 'newBase'). $this->view->render('home/index', ['list' => $list]); }Use your data inside view file.
foreach ($list as $item) { // whatever }Remember that if you define base view, it must contain this or similar line od code:
echo $content;
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-06-12