diasfs/twig-relative-path
最新稳定版本:1.0.1
Composer 安装命令:
composer require diasfs/twig-relative-path
包简介
Twig extension to work with relative paths
README 文档
README
An extension for Twig that allows to include and extends templates using relative paths.
Instalation
composer require diasfs/twig-relative-path
Initialization
use Twig\Extension\RelativePathExtension; use Twig\Environment; ... $twig = new Environment($loader); $twig->addExtension(new RelativePathExtension());
Example
{# layout.html.twig #} <!DOCTYPE html> <html> <head> ... </head> <body> {% block content '' %} </body> </html> {# pages/inc/form.html.twig #} <form> ... </form> {# pages/page.html.twig #} {% extends "../layout.html.twig" %} {% block content %} {% include './inc/form.html.twig' %} {% endblock %}
The resulting html will be the following:
<!DOCTYPE html> <html> <head> ... </head> <body> <form> ... </form> </body> </html>
License
The library is released under the MIT License. See the bundled LICENSE file for details.
统计信息
- 总下载量: 151
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-28