Plon:使用默认皮肤进行管理
我正在为 Plone 3.x 开发皮肤。该皮肤与默认主题有很多差异,我想将默认皮肤保留在管理模式下。我读了一些像这样的解决方案 http://maurits.vanrees.org/weblog/archive/2008/01/switch-your-skin-based-on-the-url。但我无法在我的网站中使用子域,因此我无法使用这些解决方案。
我认为解决方案是这样的:
在我的 main_template.pt 中:<
总条件:“true:已通过管理员身份验证”>
''在这里放置具体的 css<
/tal>
但我不知道 Plone 中正确的语法,
谢谢。
I'm developing a skin for Plone 3.x. The skin have a lot of differences from the default theme, and i would like to keep the default skin in administration mode. I read some solutions like this http://maurits.vanrees.org/weblog/archive/2008/01/switch-your-skin-based-on-the-url . But I cannot use subdomains in my web, so I cannot use these solutions.
I'm thinking that the solution would be something like that:
In my main_template.pt:<
tal condition:"true: Autenticated as admin">
''Put here the specifics css<
/tal>
But I don't know the correct sintax in Plone
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的解决方案将会起作用 - 但还有更好的方法。您没有描述样式表的安装方式,但有两种方法可以实现。
如果您有保单产品,请将以下内容放入您的产品的 profile/default/cssregistry.xml 中:
或者;访问ZMI(Zope管理界面)中的“portal_css”。您可以通过“添加”上面显示的两个样式表来执行相同的操作,其中“条件”是上面“表达式”中的值。
这些是同一件事 - 一个只是通过网络设置,另一个通过 GenericSetup - 现在 Plone 会自动将一个或另一个 css 文件合并到每个页面中,而无需更改 main_template.pt。这是你永远不应该做的事情。
Your solution will work - but there are better ways. You don't describe how your stylesheets are installed, but here are two ways to do it.
Either, if you have a policy product, put the following in your product's profiles/default/cssregistry.xml:
or; visit "portal_css" in the ZMI (Zope management interface). There you can do the same thing by "Add"ing the two stylesheets shown above, where "condition" is the value from "expression" above.
These are the same thing - one just sets it through the web, the other through GenericSetup - and now Plone will automatically incorporate one or the other css file into every page without you having to change main_template.pt. Which is something you should never, ever, do.
这并不能直接回答您的问题,但您可能想看看“Editskin 切换器”。
This doesn't answer your question directly, but you might want to take a look at "Editskin switcher".
最后我使用了这个解决方案。检测您是否通过身份验证的条件是 tal:condition="not: here/portal_membership/isAnonymousUser"。因此,您可以仅对访问者使用样式表,对经过身份验证的用户使用其他样式表。类似这样的东西:
<样式 type="text/css" tal:content="string:@import url($portal_url/visitors.css);" media="all" tal:condition="此处/portal_membership/isAnonymousUser" />
<样式 type="text/css" tal:content="string:@import url($portal_url/admin.css);" media="all" tal:condition="not: 这里/portal_membership/isAnonymousUser" />
也许这不是最佳解决方案,但它对我有用
Finally, I used this solution. The condition to detect if you are authenticated is tal:condition="not: here/portal_membership/isAnonymousUser". So, you can use a stylesheet only for visitors and other stylesheet for authenticated users. Something like that:
< style type="text/css" tal:content="string:@import url($portal_url/visitors.css);" media="all" tal:condition="here/portal_membership/isAnonymousUser" />
< style type="text/css" tal:content="string:@import url($portal_url/admin.css);" media="all" tal:condition="not: here/portal_membership/isAnonymousUser" />
Maybe this is not the optimal solution, but it works for me