自定义一个document_view并添加一个div?
这感觉像是一个新手问题,但是:
我正在尝试从下拉显示菜单创建一个新页面,以便我可以为页面提供背景颜色(因此最终用户不必进入 html 并添加分区)。我尝试向模板添加一个新的(空)div,但它不起作用。这可能吗?
这是我的代码(我的 div 称为“s_holder”):
<metal:field use-macro="python:here.widget('text', mode='view')">
Body text
</metal:field>
<div metal:use-macro="here/document_relateditems/macros/relatedItems">
show related items if they exist
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
<div id="s_holder"></div><!--end s holder-->
</body>
</html>
This feels like a newbie question but:
I am trying to create a new page from the drop-down display menu so that I can supply a background color to the page (so end user doesn't have to go into the html and add a div). I tried adding a new (empty) div to the template but it's not working. Is this even possible?
Here is my code (my div is called "s_holder"):
<metal:field use-macro="python:here.widget('text', mode='view')">
Body text
</metal:field>
<div metal:use-macro="here/document_relateditems/macros/relatedItems">
show related items if they exist
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
<div id="s_holder"></div><!--end s holder-->
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于创建新显示视图的部分:正如@Auspex所说,您应该将div放在宏内。
要将显示视图添加到下拉菜单,您需要编辑每种内容类型。有两种方法可以做到这一点:
1- 在产品的 genericsetup 配置文件中手动添加一个“types”文件夹,并为每种内容类型放入一个 xml 文件。例如:
File.xml
2- 在 ZMI 中 -> Portal_types 编辑每个内容类型以添加显示视图,然后在 Portal_setup 工具中导出类型的步骤。将 xml 定义从下载的存档中提取到 genericsetup 配置文件(在“types”文件夹中),然后编辑它们以删除无用的部分,如上所述。
For the part of creating the new display view: as @Auspex said, you should put the div inside the macro.
To add your display view to the drop down menu you need to edit every content type. There are two ways of doing this:
1- manually add a "types" folder in the genericsetup profile of your product and put inside one xml file per content type. Ex:
File.xml
2- in the ZMI -> portal_types edit every content type to add your display view and then in the portal_setup tool export the step for types. Extract the xml definitions from the downloaded archive to your genericsetup profile (in the "types" folder) and then edit them to remove unuseful parts as above.
当然你能做到。我不相信这是一个好主意:-),但你需要
那么您究竟如何将其添加到“下拉显示菜单”中?
Sure you can do it. I'm not convinced it's a good idea :-), but you need the <div> to be inside the main_macro (your example HTML is invalid - you have a </tal:main-macro> and no start tag, but I'm assuming you just cut and pasted the last part of the template here, because that template would never display, if it was written that way.
That said, how exactly are you adding it to "the drop-down display menu"?