latrell / smarty
此包让您优雅地运行Smarty3在Laravel5上。
1.2
2014-10-13 08:08 UTC
Requires
- php: >=5.3.0
- illuminate/support: 4.2.*
- smarty/smarty: 3.1.19
This package is not auto-updated.
Last update: 2024-09-14 15:11:21 UTC
README
此包让您优雅地运行Smarty3在Laravel5上。
安装
composer require latrell/smarty dev-master
使用 composer update
或 composer install
更新包。
用法
要使用Smarty服务提供器,您必须在启动Laravel应用程序时注册提供器。主要有两种方法可以实现。
在 config/app.php
中找到 providers
键并注册Smarty服务提供器。
'providers' => [ // ... 'Latrell\Smarty\SmartyServiceProvider', ]
然后使用 php artisan vendor:publish
发布配置文件。这将添加 config/latrell-smarty.php
文件。此配置文件是您与Smarty交互的主要方式。
然后只需使用Laravel的正常点语法引用模板。
例如,要加载smarty模板 views/blog/post.tpl
,您将使用 view('blog.post')
。
在Smarty的 {include}
或 {extends}
标签中,您应继续使用完整的目录语法,例如 {extends file="blog/post.tpl"}
。