首页 > 解决方案 > Crafter CMS:从不同的页面/内容类型检索数据

问题描述

是否可以从单独的页面检索数据?我只知道如何contentModel.VARIABLENAME在我的 ftl 模板中使用。

例如,我目前在Page A但我要显示的数据来自Page B

标签: freemarkercrafter-cms

解决方案


您可以使用siteItemService

<#assign pageB = siteItemService.getSiteItem("/site/website/path/to/pageB/index.xml") />

您只需要替换path/to/pageB侧边栏中所示的页面路径。返回的对象与 的类型完全相同contentModel,因此您可以这样做siteItemService.VARIABLENAME


推荐阅读