基于cookie切换重氮(plone.app.theming)主题

发布于 2025-01-04 01:41:43 字数 84 浏览 0 评论 0原文

我希望能够使管理员能够更改当前仅用于他们的主题。可能通过设置 cookie 或特殊 url。这将使他们能够调试其主题的副本,同时另一个版本可供其他人使用。

I'd like to be able to enable administrators to change which theme is currently being used just for them. Possibly by setting a cookie, or special url. This will enable them to be able to debug a copy of their theme while another version is live for everyone else.

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

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

发布评论

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

评论(3

断念 2025-01-11 01:41:43

支持这一点需要在 plone.app.theming 上进行工作,以便可以为不同的 CMF 皮肤配置不同的重氮主题。它在我的路线图上,但我不知道什么时候能实现。如果您有兴趣开发此功能或赞助它,请与我联系。

Supporting this would require work on plone.app.theming so that different diazo themes could be configured for different CMF skins. It's on my roadmap, but I don't know when I'll get to it. Contact me if you're interested in working on this feature or sponsoring it.

晚雾 2025-01-11 01:41:43

我做了类似的事情,使用主机名来决定使用哪个重氮主题。使用不同的rules.xml、index.html 和自定义资源没有问题。主题插件是另一个故事(覆盖、视图、浏览器层等),我不知道在每个请求上注册/取消注册主题插件有多好。

我回家后会更新此评论,以便您可以看到我做了什么。如果我没记错的话,我对从 plone.app.theming (应用主题的组件)注册的内容进行了子类化和替换。

I've made something similar that uses the hostname to decide which diazo theme to use. There was no problems having a different rules.xml, index.html and custom resources. The themingplugins was another story (overrides, views, browserlayer etc), I don't know how good it is to register/unregister themingplugins on each request.

I'll update this comment when I get home so you can see what I did. If I remember correctly I subclassed and replaced something registered from plone.app.theming (the component that applies the theme).

半边脸i 2025-01-11 01:41:43

我没有尝试过,但它可能会这样工作:

为当前使用的主题定义一个参数。
请注意,您需要在portal_skins/manage_propertiesForm中启用“允许选择任意皮肤”

[theme:parameters]
theme = python:self.context.REQUEST.get('plone_skin', 'Plone Default')

,并根据rules.xml中的此参数选择主题或规则集

<theme href="theme1.html" if="$them = 'special theme'"/>
<theme href="default.html" if="$them = 'Plone Default'"/>

i did not try this out but it could possibly work this way:

define a parameter for the currently used theme.
note that you'll need to enable "Allow arbitrary skins to be selected" in portal_skins/manage_propertiesForm

[theme:parameters]
theme = python:self.context.REQUEST.get('plone_skin', 'Plone Default')

and select the theme or ruleset based on this parameter in your rules.xml

<theme href="theme1.html" if="$them = 'special theme'"/>
<theme href="default.html" if="$them = 'Plone Default'"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文