[Zope] Executing a text file as a ZPT from a product
Sascha Welter
zopelist at betabug.ch
Mon May 4 03:38:41 EDT 2009
(Sun, May 03, 2009 at 09:26:57AM +0200) Jakob Schou Jensen wrote/schrieb/egrapse:
> Im am writing a product and would like to include ZPT's as part of the
> product. Is there a way that I can evaluate a piece of text (preferrably
> stored as a text file in the product folder) as a ZPT?
Yes of course you can - and about every guide on writing your own product
shows you how to do it.
For example just look at my BetaBoring sample product:
http://papakiteliatziar.gr/BetaBoring
What you do is use PageTemplateFile:
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
...
_www= os.path.join(os.path.dirname(__file__), 'www')
...
index_zpt = PageTemplateFile(_www+'/index.zpt', globals())
Regards,
Sascha
More information about the Zope
mailing list