我试图动态地改变每一页的样式,但使用plone.app.theming (重氮)的Plone首页。
到目前为止,我已经拼凑到一起,但它打破了我的主题:
<replace css:content="#some-div" if-path="not(body.section-front-page)"
<style type="text/css">
#some-div { margin: 0 2.25em }
</style>
</replace>任何关于如何编写组合的if-not路径和动态修改样式的帮助都将不胜感激!添加了缺失的结束标签,仍然不起作用。
发布于 2012-03-05 07:57:08
对我来说,您的rules.xml文件中似乎有几个错误。
( a)替换需要一个内容和主题属性。请参阅http://docs.diazo.org/en/latest/basic.html#replace
( b)您通常不会将css放入rules.xml文件中。上面插入的方式是行不通的
如果路径条件适用于url的部分内容.你在测试身体的某一类别。你宁愿选择其中之一
if-path="/front-page"
if-content="body.section-front-page"(见http://docs.diazo.org/en/latest/advanced.html#conditions-based-on-paths)
最好的起点是浏览文档http://pypi.python.org/pypi/plone.app.theming
下载plone.org上的一个重氮主题作为模板http://plone.org/products?getCategories=themes&getCompatibility=Plone+4.1&SearchableText=diazo
并在http://docs.diazo.org上查找不同的规则
发布于 2012-03-05 19:10:22
我不认为重氮是解决这个问题的正确工具,试试下面的CSS:
#some-div { margin: 0 2.25em }
body.section-front-page #some-div { margin: 0 }Plone的节css类的好处是,它允许您为整个站点编写一个CSS文件,同时仍然针对特定部分的规则。
发布于 2012-06-08 03:09:54
假设您的首页是带有“头版”id的文档,那么您可以这样做:
<?xml version="1.0" encoding="UTF-8"?>
<rules
xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css">
<rules css:if-content="body.section-front-page.template-document_view)">
<!-- here you put rules for the front page only -->
</rules>
<rules css:if-content="body:not(.section-front-page.template-document_view)">
<after css:content-children="head">
<style>
#some-div { margin: 0 2.25em; }
</style>
</after>
</rules>
</rules>例如,指定..template document_view可以帮助您避免在家中使用@@manage屏幕。
https://stackoverflow.com/questions/9557264
复制相似问题