guguanghai / 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-20 19:15:22 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"}
。