Integrating Zope Applications with Plone
Still need or want to use classic Zope components, but also have them nicely integrate into your Plone Site?
This is not a recommended development method for modern web development with either Zope or Plone, however, if you either have some legacy Zope web application lying around, or just need to do something very simple. This can easily allow Zope applications to nicely integrate with the Plone website and theme.
Currently, this will only work if your legacy Zope web applications use Page Templates, rather than DTML Method/Document. This is because that the main Plone website theme uses Page Templates itself, and so that is what we will be extending within a traditional Zope backend application. This will also only work with the Classic UI of course.
If you need to insert additional metadata into the HTML document, such as a base href for when you are using virtual hosting, as it sometimes doesn't seem to automatically insert that for me, you'll also want to create a base template which all of your other templates will then use. This is a basic example of a Page Template to add a base href to all of your Zope application pages:
You can call this for example plone_template:
<html xmlns="http://w3.org" xml:lang="en" lang="en" metal:define-macro="page" metal:use-macro="context/main_template/macros/master"> <metal:topslot fill-slot="top_slot"> <base tal:attributes="href string:${context/absolute_url}/"/> </metal:topslot></html>
Here, we are using the macros located in the main_template Page Template, which is where the main Plone website template lives, and adding a new tag into the head element.
Next, you'll need to update your existing Zope application Page Templates to use this specific template via:
<html xmlns="http://w3.org" xml:lang="en" lang="en" metal:use-macro="context/plone_template/macros/page"> <metal:slot fill-slot="body"> <h2>Plone Template Test!</h2> </metal:slot></html>
If you place these files into a new folder in the Zope Management Interface on a Plone website, and load this final Page Template we created, you should see the Plone website as usual, but in the body where the usual Plone content is, you'll see the message above.
I have updated all the legal Zope Examples so you can see this in action. Enjoy!
