如何更改“事件” Plone 3 中的 portlet

发布于 2024-08-01 15:56:06 字数 946 浏览 2 评论 0原文

我正在尝试在 Plone 3 中自定义“事件”portlet,以显示即将发生的事件。 该 portlet 页脚中的“查看”链接转到 /events URL。 但我的网站是多语言的,因此 URL 并不总是正确的。 例如,荷兰活动的正确 URL 应为 /evenementen。

在我的设置中,我对每种语言使用一个文件夹。 /en 包含所有英语内容,/nl 包含所有荷兰语内容,等等。 plone 根没有 portlet,因此我将“Event”portlet 分别添加到 /nl 和 /en 文件夹中。 我在 ZMI 的 events.pt 模板中查找,它似乎从属性中获取 URL,但是该属性定义在哪里以及如何更改它? 我在 ZMI 中找不到 portlet 配置。 以下是来自 plone.app.portlets.portlets/events.pt 的片段:

<dd class="portletFooter">
    <a href=""
       class="tile"
       tal:attributes="href view/all_events_link"
       i18n:translate="box_upcoming_events">
            Upcoming events&hellip;
    </a>
    <span class="portletBottomLeft"></span>
    <span class="portletBottomRight"></span>
</dd>

那么,我可以在 ZMI 中的某个地方更改 all_events_link 属性吗? 如果是的话,在哪里?

作为替代方案,我还尝试添加一个“Collection”portlet,其中包含列出所有事件的集合。 但问题是集合 portlet 不想显示事件的开始日期和结束日期。

I am trying to customize the "Event" portlet in Plone 3 that shows the upcoming events. The "view" link in the footer of that portlet goes to the /events URL. But my site is multi-lingual so that URL is not always correct. For example, the correct URL for Dutch events should be /evenementen.

In my setup I use one folder per language. /en holds all English content, /nl holds all Dutch content, etcetera. The plone root has no portlets so I add the "Event" portlet to both the /nl and /en folder separately. I was looking in the ZMI at the events.pt template and it seems that it takes the URL from a property, but where is that property defines and how can I change it? I can't find the portlet configurations in the ZMI. Here is the snippet from plone.app.portlets.portlets/events.pt:

<dd class="portletFooter">
    <a href=""
       class="tile"
       tal:attributes="href view/all_events_link"
       i18n:translate="box_upcoming_events">
            Upcoming events…
    </a>
    <span class="portletBottomLeft"></span>
    <span class="portletBottomRight"></span>
</dd>

So, can I somewhere change that all_events_link property in the ZMI? If so, where?

As an alternative I have also tried to add a "Collection" portlet with a collection that lists all events. But the problem is that the collection portlet doesn't want to show the start and end dates for the events.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满天都是小星星 2024-08-08 15:56:06

事件 portlet 使用视图为其提供数据,表达式“view/all_events_link”调用 该视图上的方法 为其提供链接。 您有 2 个选项来替换该链接:

  1. 注册您自己的事件 portlet,该事件 portlet 是旧事件 portlet 的子类,并替换 all_events_link 方法。 这是重度定制选项,并且需要 Python 编码。 请参阅 此邮件线程介绍了如何实现这一目标的一些常规指示。

  2. 仅用 portlet 渲染器替换模板。 Martin Aspeli 在 Plone.org 上 记录了此方法; 这仅需要一些 ZCML 配置即可开始工作。 然后,您可以复制 events.pt 模板,并将 portlet 页脚替换为链接到正确位置的页脚。

The events portlet uses a view to provide it with data, and the expression 'view/all_events_link' calls a method on that view to provide it with a link. You have 2 options to replace that link:

  1. Register your own event portlet that subclasses the old one, and replaces the all_events_link method. This in the heavy customization option, and requires Python coding. See this mail thread on some general pointers on how to achieve this.

  2. Replace just the template with a portlet renderer. Martin Aspeli has documented this method on Plone.org; this only requires some ZCML configuration to get working. You can then copy the events.pt template and replace the portlet footer with one that links to the right location.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文