[Zope] Re: Zope ZMI Templates
Tres Seaver
tseaver at palladion.com
Tue Jan 15 14:02:10 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jurian Botha wrote:
> I'm currently developing some customized ZMI pages and I was hoping someone
> could give me some insight into what the best way would be to do this.
>
> I see that Zope 2 uses dtml methods to build the standard ZMI pages but as
> far as I know (Zope 3 wise) I should rather be using Zope Page Templates to
> build the pages.
>
> I would also like the product to gracefully move on to Zope 3 in future, so
> that should be taken into consideration as well.
>
> Are there perhaps some existsing templates for ZMI that can also be used
> with Zope 3?
You could choose to use a 'zmi_master' template which looked like so::
<metal:x metal:define-macro="master">
<tal:x tal:replace="structure context/manage_page_header" />
<tal:x tal:replace="structure context/manage_tabs" />
<div metal:define-slot="main">
Non-boilerplate goes here.
</div>
<tal:x tal:replace="structure context/manage_page_footer" />
</metal:x>
If you registered that template as a view in your product's
'configure.zcml', e.g.:
<browser:page
for="*"
name="zmi_master"
template="zmi_master.pt"
/>
you can then use it in your own ZMI templates, e.g.:
<html metal:use-macro="context/@@zmi_master/macros/master">
<body>
<div metal:fill-slot="main">
<h1> Test ZMI Macro </h1>
</div>
</body>
</html>
I have attached a tarball of a simple Zope2 product which does this.
After installation, you should be able to visit
http://localhost:8080/zmi_test to see the results.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHjQMy+gerLs4ltQ4RAvHpAJ4h8VuFM3M4v333UU4jB71CJgvNqgCfcnjf
YMSO8d3hiDf5eMyG31nn9Ng=
=fh+F
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zmi3.tar.gz
Type: application/gzip
Size: 809 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080115/359f07a7/zmi3.tar.bin
More information about the Zope
mailing list