huzemin / slim-views
Smarty template enigine for Slim Framework 3.x
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/huzemin/slim-views
Requires
- php: >=5.5
- smarty/smarty: ~3.1
This package is not auto-updated.
Last update: 2025-10-15 22:37:33 UTC
README
用于Slim Framework 3.x 的Smarty View组件
安装
可直接从github上直接下载,放置在项目中, 然后配置composer自动导入。
使用
$smarty_config = array(
'templateDir' => 'templateDir',
'compileDir' => 'compileDir'',
'cachedDir' => 'cachedDir',
'configDir' => 'configDir',
'pluginsDir' => array(
...
)
);
use \Slim\Views\SmartyView as View;
// Setup Slim Framework
$app = new App();
$container = $app->getContainer();
$container['view'] = function($c) {
$smarty_config = load_config('smarty');
$view = new View($smarty_config);
$view->addExtionsions($c,$smarty_config['pluginsDir']);
return $view;
};
说明
程序借鉴了slimphp/Twig-View的实现方式。 程序可以自由修改!!