Using Zope Page Templates for forms (tabs of products)
I have a product for which I am adding another tab, or lable or whatever you call it, that is, I added a dict to manage_options. Now, what I'm doing in fact, is turning a script and a template I did to a tab to integrate it in the product. I've done everything with zpt (I try to avoid dtml) Congratulations ;-)
<dtml-var manage_page_header> ... <dtml-var manage_tabs> ... and <dtml-var manage_page_footer> Take a look at: http://www.zope.org/Members/Zen/howto/ZPT_management.
<dtml-with "_(management_view='Bounce')"> To do this, you have to pass a parameter to the Template like this:
from Products.PageTemplates.PageTemplateFile import PageTemplateFile _myTemplate=PageTemplateFile('zpt/myTemplateName',globals()) #The management_view attribute is passed to the page template def manage_something(self): """Here some attributes are added to the template""" #This is necesary in order to allow other users to access to this template _myTemplate._owner=None #Adds the management_view attribute to the built-in variable "options" return _myTemplate.__of__(self)(management_view='Bounce') Then you can use it from zpt: <div tal:define="management_view options/management_view"> Do something here with management_view </div>
And how do I make a call similar to this: DTMLFile('dtml/manage_bounceForm', globals()) Already answered, see above.
but for a zpt (currently, I have the zpt as an object, created in an instance of the product, not as a file on the product, and I'm calling it like this: return self.importerTemplate(self, REQUEST, message=None) Ah, you mean a ZPT on the Zope DB? I've seen this on the source of Siva, but I don't remmember the proper sintax. However, I found this on my bookmarks -> I haven't tested it and I don't know if it is the right approach: http://mail.zope.org/pipermail/zope/2004-May/149907.html
This could be useful as well: http://www.zope.org/Members/peterbe/DTML2ZPT Regards, Josef _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus
participants (1)
-
Josef Albert Meile