phmlabs/twigcontentbundle

该包的最新版本(dev-master)没有可用的许可证信息。

包含来自不同来源的内容

dev-master 2019-08-09 13:37 UTC

This package is auto-updated.

Last update: 2024-09-10 00:12:31 UTC


README

#TwigContentBundle

这个Twig标签扩展可以帮助从不同来源提供内容片段。如果没有定义内容检索器,它还提供了一个回退情况。

使用方法

{% content status_no_projects_yet %}
    This is the default text for the content snippet with the identifier status_no_projects_yet. 
    It will appear if the configured retriever does not return content.
{% endcontent %}

内容检索器

空检索器

空检索器返回内容块内部定义的文本。空检索器是标准检索器,不需要配置。

HTTP 检索器

可以使用HTTP检索器通过HTTP请求获取内容。

# app/config/services.yml

services:
    phmlabs.content.retriever:
        class: phmLabs\TwigContentBundle\Retriever\HttpRetriever
        arguments: ["http://cms.example.com/#identifier#"]