定制 tc/twig-global-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tc/twig-global-bundle

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tc/twig-global-bundle

包简介

TcTwigGlobalBundle

关键字:

README 文档

README

Latest Stable Version

SensioLabsInsight

Provides some useful twig tags for global variables.

Installation

composer require tc/twig-global-bundle

Enable the bundle in your AppKernel.php

$bundles = array(
    // ...
    
    new Tc\Bundle\TwigGlobal\TcTwigGlobalBundle(),
    
    // ...
);

Usage

Usage in Twig:

{# set a global #}
{% global title = 'My Title' %}

{# get a global #}
{% global title %}

{# merging #}
{% global title ~ ' | My Title Suffix' %}

{# set defaults #}
{% global title 'My Title' default %}
{# this can be overwritten in a child template #}
{% global title 'My Other Title' %}

{# working with arrays #}
{% global colors = ['red', 'green', 'blue'] %}
{% global colors ~ 'purple' %} {# red, green, blue, purple #}
{% global colors ~ ['red', 'blue', 'yellow'] unique %} {# red, green, blue, purple, yellow #}

{# access globals outside of tag #}
{{ _tc_global.get('title', 'some default value') }}
{{ _tc_global.set('title', 'value', true /* default */) }}
{{ _tc_global.merge('colors', 'purple', false /* default */, false /* unique */) }}

Usage in PHP via the tc.twig_global service:

$container->get('tc.twig_global')->set('title', 'something');
$container->get('tc.twig_global')->get('title');
$container->get('tc.twig_global')->merge('colors', 'blue');
// etc

License

TcTwigGlobalBundle is licensed with the MIT license.

See LICENSE for more details.

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固