我有两个不同 PageTypes 的列表 - NewsItems 和 PressReleases。它们分别显示在一个列表中,并带有指向各个项目的链接。
现在我想将新闻稿项目包含到新闻列表中,并使用新闻项目的样式将它们显示为新闻项目。它们共享新闻模板中使用的“标题”和“正文”等属性。
我想用两组页面来提供 NewsItems 的 ListPage 并不难,但我不明白如何控制项目页面的呈现。
如果在 NewsList 中选择它,我想从 NewsItem 或 PressReleaseItem 中获取 PageData 对象并使用 News-Item.aspx 模板显示它。但是 EPiServer 将始终使用 PR-Item.aspx 呈现 PressReleaseItem,因为它在 PageType 设置中耦合。
有谁知道如何做到这一点?
编辑:努力澄清:
重要的问题是如何知道“列表父级”并从中选择正确的模板。In the ListPage I can apply different looks on the PR and News items respectively using tompipes answer, but when selecting to see an individual item EPi will render the PR-Item-1 the same way regardless of their "list parent". 那就是问题所在。