werkint/templating-bundle

此包已被废弃,不再维护。未建议替代包。

安装: 920

依赖: 0

建议者: 0

安全: 0

星星: 1

关注者: 6

分支: 0

开放问题: 0

类型:symfony-bundle

v0.1.1 2016-01-11 11:30 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:48:24 UTC


README

已弃用

使用twig编译代替;您还可以使用bower

Composer

composer require 'werkint/templating-bundle:dev-master'

内核

AppKernel::registerBundles

        ...
    new \Werkint\Bundle\TemplatingBundle\WerkintTemplatingBundle()
        ...

路由

app/config/routing.yml

    werkint_templating.:
      resource: "@WerkintTemplatingBundle/Resources/config/routing.yml"
      prefix: "/api"
      options:
        expose: true
$router->generate('ajax_templating', ['template' => '@YourBundle/Some/someTemplate.twig'])

或者

define([
    'some-module/views/view',
    'werkint-templating/template!@YourBundle/Some/someTemplate.twig'
], function (View, template) {
    'use strict';

    return View.extend({
        'template': template,
    });
});

JS

bower install template --save

或者包含 web/bundles/werkinttemplating/js/*.js

公共模板

@YourBundle/Resources/config/templates.yml

parameters:
  your_bundle.public_templates:
    - @@YourBundle/Some/someTemplate.twig
services:
  your_bundle.public_template_provider:
    class: Your\Bundle\SomeBundle\Service\TemplateProvider
    arguments:
      - % your_bundle.public_templates%
    tags:
      - {name: werkint_templating.public_template }

或者 Werkint\Bundle\TemplatingBundle\Service\TemplateProviderInterface