Content management system 在Zotonic中如何支持每页边栏内容?
我想要Zotonic中每页的侧边栏内容:Content management system 在Zotonic中如何支持每页边栏内容?,content-management-system,erlang,zotonic,Content Management System,Erlang,Zotonic,我想要Zotonic中每页的侧边栏内容: 链接 白皮书 网络研讨会 做这件事的好方法是什么?我需要什么样的模板片段才能让它工作?登录Zotonic管理界面 创建谓词: 链接(文本->文本) 白皮书(文本->文档) 网络研讨会(文本->文本) 这些谓词随后显示在页面编辑器的页面连接中。以这种方式添加到其他页面、白皮书和网络研讨会页面的链接 将以下内容添加到\u article\u sidebar.tpl: {% with m.rsc[id].links as texts %} {%
- 链接
- 白皮书
- 网络研讨会
做这件事的好方法是什么?我需要什么样的模板片段才能让它工作?登录Zotonic管理界面 创建谓词:
- 链接(文本->文本)
- 白皮书(文本->文档)
- 网络研讨会(文本->文本)
\u article\u sidebar.tpl
:
{% with m.rsc[id].links as texts %}
{% if texts %}
<h2>See also:</h2>
<ul>
{% for text in texts %}
<li><a href="{{ m.rsc[text].page_url }}" {% ifequal text id %}class="current"{% endifequal %}>{{ m.rsc[text].title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% with m.rsc[id].white_papers as texts %}
{% if texts %}
<h2>White papers:</h2>
<ul>
{% for text in texts %}
<li><a href="{{ m.rsc[text].page_url }}" {% ifequal text id %}class="current"{% endifequal %}>{{ m.rsc[text].title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{% with m.rsc[id].webinars as texts %}
{% if texts %}
<h2>Related webinars:</h2>
<ul>
{% for text in texts %}
<li><a href="{{ m.rsc[text].page_url }}" {% ifequal text id %}class="current"{% endifequal %}>{{ m.rsc[text].title }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
{%与m.rsc[id]。链接为文本%}
{%if text%}
另见:
{%用于文本中的文本%}
{%endfor%}
{%endif%}
{%endwith%}
{%带有m.rsc[id]。白皮书作为文本%}
{%if text%}
白皮书:
{%用于文本中的文本%}
{%endfor%}
{%endif%}
{%endwith%}
{%m.rsc[id]。网络研讨会作为文本%}
{%if text%}
相关网络研讨会:
{%用于文本中的文本%}
{%endfor%}
{%endif%}
{%endwith%}
当您添加谓词时,它允许您在Zotonic中将元数据添加到RSC(页面、媒体等)。每个谓词都允许您将RSC集合连接到Zotonic接口中的RSC。此集合作为RSC的ID存储和访问
谓词元数据可以在模板中访问。表达式m.rsc[id].links
选择连接到当前页面的rsc的id集合作为链接
表达式m.rsc[id]
为正在呈现的页面选择rsc。表达式m.rsc[text]
为连接的rsc选择rsc
表达式
{%ifequal text id%}class=“current”{%endifequal%}
有条件地呈现一个CSS类属性,该属性改变链接样式以指示它是当前页面。有能力这样做的人是否可以添加标记zotonic:)谢谢