如何在每个页面中渲染 django-cms 插件?

发布于 2024-09-17 17:12:19 字数 94 浏览 4 评论 0原文

我有一个 django-cms 的最新新闻插件。

我想在页脚显示 5 条最新新闻。页脚放置在网站的每个页面上。

如何在每个页面上呈现这个插件?

I have a latest news plugin for django-cms.

I want to show 5 latest news in footer. Footer placed on every page of site.

How can I render this plugin on every page?

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

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

发布评论

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

评论(1

哥,最终变帅啦 2024-09-24 17:12:19

有一些模板标签可以帮助您实现您想要做的事情:

{% placeholder "footer" inherit %}

应该从层次结构中上面的页面继承其内容,或者您​​可以从另一个页面呈现占位符,

{% show_placeholder "footer" "home" %}

组合

   {% placeholder "footer" or %}
   {% show_placeholder "footer" "home" %}
   {% endplaceholder %}

您也可以进行像通常呈现的 页面“home”中占位符“页脚”的内容,但如果您在当前页面的占位符中放置某些内容,它将呈现此内容!

There are some template tags that should help you achieve what you are trying to do:

{% placeholder "footer" inherit %}

should inherit its content from pages above in the hierarchy, or you can render a place holder from another page with

{% show_placeholder "footer" "home" %}

you can also make a combination like

   {% placeholder "footer" or %}
   {% show_placeholder "footer" "home" %}
   {% endplaceholder %}

which will normally render the contents of the placeholder "footer" from page "home", but if you place something in the placeholder of the current page it will render this content!

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