comnect / smarty
2.0.1
2014-10-13 04:03 UTC
Requires
- php: >=5.4.0
- illuminate/config: 4.2.*
- illuminate/support: 4.2.*
- illuminate/view: 4.2.*
- smarty/smarty: 3.*@stable
Requires (Dev)
- mockery/mockery: 0.8.0
- phpunit/phpunit: 3.7.*
- symfony/console: 2.*
- symfony/framework-bundle: 2.*
README
#此项目已被弃用 新的 Laravel.Smarty 项目 -> Laravel.Smarty
"require": { "comnect/smarty": "2.*" },
###对于 Laravel4.1
"require": { "comnect/smarty": "1.*" },
##laravel4的基本smarty模板
在laravel4中可以使用smarty。
可以直接使用blade的语法,
此外,通过View Facade,可以使用smarty的所有方法。
轻松使用所有smarty方法
###需要使用数组短语法!
// laravel4 blade template render View::make('template', ['hello']); // use smarty method View::assign('word', 'hello'); View::clearAllAssign(); // smarty method
##Artisan 缓存清除、编译文件删除可以通过命令行执行。
smarty的缓存清除、从Artisan/cli中删除编译类 ###缓存清除
$ php artisan comnect:smarty-cacheclear
选项
--file (-f) 指定文件
--time (-t) 清除指定持续时间的所有文件
###删除编译类
$ php artisan comnect:smarty-clear-compiled
选项
--file (-f) 指定文件
用法 使用方法
安装后,请将以下namespace添加到app/config/app.php中的providers数组中。
添加提供者
'Comnect\Smarty\SmartyServiceProvider'
发布config文件。
发布配置
$ php artisan config:publish comnect/smarty
发布到app/config/packages
发布到app/config/packages
如果views下有smarty文件,则将其用作模板,
如果没有,则按常规使用blade模板或php文件。
在smarty模板内也可以直接使用*{{app_path()}}*等助手函数。
在这种情况下,请勿指定与blade相同的delimiter。
可以在config文件中指定这些设置。