BOLT cms如何在旁边回应标题?
问题描述:
我是新来的螺栓,我想了解一些进来的默认主题的代码,我看到下面我_aside.twig模板旁白代码:BOLT cms如何在旁边回应标题?
{% for ct in config.get('contenttypes') if not ct.viewless|default(false) %}
{% setcontent records = ct.slug ~ "/latest/3" %}
<h5>{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}</h5>
<ul>
{% for record in records %}
<li><a href="{{ record.link }}">{{ record.title }}</a></li>
{% else %}
<li>{{ __('contenttypes.generic.no-recent', {'%contenttype%': ct.slug}) }}</li>
{% endfor %}
</ul>
<p><a href="{{ path('contentlisting', {'contenttypeslug': ct.slug}) }}">{{ __('contenttypes.generic.overview',{'%contenttypes%': ct.name}) }} »</a></p>
{% endfor %}
我不很明白下面的一行代码:
{{ __('contenttypes.generic.recent', {'%contenttypes%': ct.name}) }}
什么是上面的代码行真的这样做,我知道它添加在一旁等的标题为“最新文章”,“最近更新”,但它是如何真的有用吗?
答
正如你可以在这里看到:
这些消息的命名空间,便于transalation。您提到的代码只是用实际内容类型名称替换字符串%contenttypes%
,然后打印新消息。