Plone 4 : Get the parent of a page in a portlet template

标签 plone plone-4.x

我有这样的东西:site/country-1/item-1/item-2/item-3

在项目 3 中,我有一个 portlet。在它的模板中,我试图显示 Item 2 的标题或 Item 1 .我该怎么做?

<div tal:content="python:context.Title()"></div>给我Item 3 .

<div tal:content="python:context.aq_parent"></div>给我<plone.app.portlets.portlets.classic.Renderer object at 0x7fa76b97a990>

<div tal:content="python:view"></div>同样:<plone.app.portlets.portlets.classic.Renderer object at 0x7fa76b97a590>

我需要此信息来实现解决方案,以在任何级别按母国过滤新闻项和事件。

最佳答案

获取链可能与您预期的不同。 要查看采集链,请检查 context.aq_chain

尝试 context.aq_inner.aq_parent 可能会有好运。 无论如何,我会使用 plone_context_state View ,即:context/@@plone_context_state/parent

相关链接:

关于 Plone 4 : Get the parent of a page in a portlet template,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42831635/

相关文章:

plone - 如何从 Plone 的搜索结果中排除文件夹?

jquery - 如何调试Plone的portal_javascripts压缩导致的js错误

forms - 我可以在 Plone 4.3 中使用 plone.protect 3.0 吗?

ldap - Plone 4 - 获取经过身份验证的用户类型

plone - Plone 5 中的 Javascript 包定义

plone - 在 Diazo 中使用什么代替 HTTP_X_XDV?

plone - 如何在 livesearch 查询的开头使用通配符进行搜索?

Plone更新收集过滤器

python - 将子域名保存为字符串

css - 更改 Plone 5.02a 的 barceloneta.css?