wxr/content-bundle

Symfony WXRContentBundle

安装: 33

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

类型:symfony-bundle

v2.1.0 2012-11-14 22:23 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:37:10 UTC


README

安装

没有特殊要求。

配置

WXRContentBundle 不需要任何配置。

默认配置

wxr_content:
    twig:
        extension:
            render:
                default_template: WXRContentBundle::contents.html.twig

Twig 扩展

WXRContentBundle 包含 wxr_content_render twig 函数。

显示名称为 "example" 的内容,标签名称或标签的别名

{{ wxr_content_render("example") }}

通过内容名称显示内容

{{ wxr_content_render({ name: content_name }) }}

通过标签名称显示内容

{{ wxr_content_render({ "tag.name": tag_name }) }}

通过标签的别名显示内容

{{ wxr_content_render({ "tag.slug": tag_slug }) }}

显示单个内容或内容数组

{{ wxr_content_render(some_contents) }}

内容将通过默认模板进行渲染(请参阅配置)。要覆盖默认模板,请将其作为第二个参数传递

{{ wxr_content_render(some_contents, 'WXRContentBundle::raw.html.twig') }}