将全局导航移动到页脚(仅在首页)的最直接方法是什么
我通过以下方式隐藏了普通 Plone 首页的各种元素:
.section-front-page #portal-globalnav {
display: none;
}
现在,我想在页脚附近的底部添加一个全局导航。我考虑过多种方法:
- 通过“显示”菜单选择的浏览器视图/模板
- 另一个 viewlet
- Javascript(好吧,我没有考虑这个,因为我不太了解 Javascript,但这似乎是可能的。)
什么是最好的方法?
I have hidden various elements of the normal Plone front page via:
.section-front-page #portal-globalnav {
display: none;
}
Now, I want to add a globalnav to the bottom near the footer. I've considered a variety of approaches:
- A browser view/template selected via the Display menu
- Another viewlet
- Javascript (OK I haven't considered this because I don't know Javascript very well, but it seems possible.)
What is the best approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Plone 4 及更高版本中,您可以将 globalnav viewlet 注册为内容提供者:
然后使用以下方法将其包含在您的主页模板或 main_template 中:
In Plone 4 and greater, you can register the globalnav viewlet as a content provider:
and then include it in your homepage template or main_template using:
头版上唯一的部分是棘手的部分。您可以使用 GS 配置文件使用特殊的一次性界面来标记首页,然后使用 ZCML 为
IPortalFooter
管理器注册plone.global_sections
viewlet上下文并且仅该上下文:您还可以使用它为
IPortalHead
注册一个虚拟的空plone.global_sections
视图,而不是使用display:无;
The only on the front page bit is the tricky part. You could use your GS profile to mark the front page with a special, one-off interface and then use ZCML to register the
plone.global_sections
viewlet for theIPortalFooter
manager for that context and only that context:You could also use this to then register a dummy, empty
plone.global_sections
viewlet forIPortalHead
instead of usingdisplay: none;
我喜欢这两个建议,但我最终做了以下事情(因为我看不到如何用其他建议做我想做的一切):
像这样的 footer2.py (到子类,没有其他):
和 footer2.pt 像this(除了 CSS id 之外,一切都相同):
CSS 像这样(仅在首页上显示 footer2):
当然,还有 footer2 默认页脚样式的副本:
I liked both suggestions, but I ended up doing the following (because I couldn't see how to do everything I wanted with the other suggestions):
With footer2.py like this (to subclass and nothing else):
And footer2.pt like this (everything the same but the CSS id):
And CSS like this (to display footer2 on the front page only):
And of course, a copy of the default footer styles for footer2:
有一种耗时少且非侵入性的方法,即不使用 viewlet,而是使用 portlet。
Products.ContentWellPortlets 允许您将 portlet 放置在内容的上方和下方。
我写了一个插件,它正在解决这个问题:adi.dropdownmenu。您可以使用它,取消分配内容上方的“扩展导航”-portlet(由collective.portlet.sitemap 提供)并在内容下方分配一个,将target-depth 设置为1,就这样。
There's a much less time consuming and non-intrusive approach, by not using viewlets, but portlets.
Products.ContentWellPortlets allows you to place portlets above and below the content.
I had written an addon, which is addressing that: adi.dropdownmenu. You can use it, unassign the "Extended navigation"-portlet (delivered of collective.portlet.sitemap) above the content and assign one below the content, set target-depth to 1, that's it.