raindrop/twigloader-bundle 问题修复 & 功能扩展

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

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

raindrop/twigloader-bundle

Composer 安装命令:

composer require raindrop/twigloader-bundle

包简介

Symfony Raindrop TwigLoaderBundle

README 文档

README

Build Status

This bundle adds database support for twig templates. It substitutes Twig_Loader_FileSystem with Twig_Loader_Chain and appends Database and FileSystem loader. To load from database, use database: syntax into render method.

INSTALLATION:

First add the dependency to your composer.json` file:

"require": {
    ...
    "raindrop/twigloader-bundle": "dev-master"
},

Then install the bundle with the command:

php composer.phar update

Enable the bundle in your application kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Raindrop\TwigLoaderBundle\RaindropTwigLoaderBundle(),
    );
}

Now the bundle is enabled.

There is also a TwigTemplateAdmin class activated only if SonataAdmin bundle is enabled in your AppKernel.php.

CONFIGURATION:

This the default configuration and can be overridden in app/config/config.yml:

doctrine:
  dbal:
    types:
      json: Sonata\Doctrine\Types\JsonType

and

raindrop_twig_loader:
    chain:
        replace_twig_loader: true
        loaders_by_id:
            raindrop_twig.loader.filesystem: 10
            raindrop_twig.loader.database: 20

This configures twig chain loader and append those specified above.

USAGE:

Load template from database:

class myController {
	public function indexAction()
    {
		return $this->render('database:contact_us_en');
	}
}

The database loader will load the template using ::getTemplate() method and pass result to controller render method.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-03-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固