kurl/silex-error-template-provider
最新稳定版本:0.1.0
Composer 安装命令:
composer create-project kurl/silex-error-template-provider
包简介
Error templates for silex
README 文档
README
Version: 0.1.0
A Silex error provider copied almost verbatim from the example in the Silex Skeleton.
Usage
The example templates rely on a layout twig file names layout.html.twig, to use these default files this template
must exist somewhere in the twig path.
Example
<?php $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider()); $app['twig'] = $app->share($app->extend('twig', function ($twig, $app) { $path = __DIR__ . '/../vendor/kurl/silex-error-template-provider'; $twig['path'] = array( $path . '/src/Resources/views' // The path to the default error templates $path . '/tests/Fixture/example' // The path to the example layout.html.twig ); return $twig; })); $app->register();
The default template suffix .html.twig can be overridden by setting the kurl.error.template_suffix value;
<?php $app['kurl.error.template_suffix'] = '.html';
Extending/customising
To provide customised templates for specific error codes extra templates can be created in the fashion
error/{code}.{suffix} in the twig path.
If a custom template was required for all 41x errors then all that is required is a template named
error/41x.{suffix} in the twig path.
To use a different set of templates to those supplied simply copy the contents of the src/Resources/views/error
directory to new sub directory also named error and add that new directory to the twig path either before or instead
of the default path and make any modifications required to the new templates.
统计信息
- 总下载量: 199
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-11