diasfs/twig-relative-path 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-28