DTML in Product WWW does not bring images
Hello Fellow Zopers, I was wondering if anyone has had any luck with doing the following: When creating your own zope product ( I guess what I mean by this is placing a python class in /lib/python very much like OFS or mxm or the like ) and using DTMLFile( view, globals ), my view.dtml file has images that I wish to use, but I have no idea where to place those images so that zope will find them -- can someone give me a clue, please. Thanks ahead of time for your help, Luis.
zope news writes:
... images in a product ... file has images that I wish to use, but I have no idea where to place those images so that zope will find them -- can someone give me a clue, please. Look at an example product with similar requirements. Database adapters are quite good.
I know that "ZGadflyDA" does it. When I looked there for the latest time (a long time ago), it had the old initialization code. Nowadays, importing the images may be more elegant. Look at a newer product, maybe DCO2. Dieter
I Tried, I really did, but I just did not get it. Looking at the code it just doesn't make sense to me. Maybe someone can give me a clue -- Here is what I started to do: Let's say that my class is in: /usr/share/zope/lib/python/MyClass In the __init__.py class i have: import Globals misc_ = { 'MyPic' : Globals.ImageFile('www/MyPic.jpg',globals()) } in MyClass.py i have index_html = DTMLFile( 'www/view_html',globals()) in view_html.dtml which is in /usr/share/zope/lib/python/MyClass/www I have .... <img src="<dtml-var SCRIPT_NAME>/misc_/MyClass/MyPic"> ..... Is this correct?? If yes, why DOESN'T SCRIPT_NAME expand to anything when viewed ? What is the value that should go there? And why does misc_ appear before MyClass, I would have thought it goes the other way around? Thanks for any help, regards, Luis. ----- Original Message ----- From: "Dieter Maurer" <dieter@handshake.de> To: "zope news" <news@conquered.org> Cc: "Zope Mailing List" <zope@zope.org> Sent: Tuesday, February 19, 2002 4:18 PM Subject: Re: [Zope] DTML in Product WWW does not bring images
zope news writes:
... images in a product ... file has images that I wish to use, but I have no idea where to place those images so that zope will find them -- can someone give me a clue, please. Look at an example product with similar requirements. Database adapters are quite good.
I know that "ZGadflyDA" does it. When I looked there for the latest time (a long time ago), it had the old initialization code. Nowadays, importing the images may be more elegant. Look at a newer product, maybe DCO2.
Dieter
zope news writes:
I Tried, I really did, but I just did not get it. Looking at the code it just doesn't make sense to me. ... images for product ... misc_ = { 'MyPic' : Globals.ImageFile('www/MyPic.jpg',globals()) } ... <img src="<dtml-var SCRIPT_NAME>/misc_/MyClass/MyPic"> .....
Is this correct?? You must register your "misc_"!
Out of hand, I do not know how you do it. But you can find out by looking through the sources in the "App" folder. Search for "misc_".
If yes, why DOESN'T SCRIPT_NAME expand to anything when viewed ? "SCRIPT_NAME" is the name of the CGI script that started Zope, provided you use "pcgi" to start Zope (what you probably do not...).
When you do not connect Zope via "pcgi", "SCRIPT_NAME" is empty (as it should be). Using Zope with "pcgi" is old, "SCRIPT_NAME" is deprecated (as it does not play well with virtual hosting). The modern replacement is "BASE1".
What is the value that should go there? And why does misc_ appear before MyClass, I would have thought it goes the other way around? Usually, products install their "misc_" in a global "misc_" registry under their name. The URL is that of the registry ("misc_") followed by the product ("MyClass") followed by the key defined in the products "misc_". Apparently, your product does not register its "misc_".
Dieter
participants (2)
-
Dieter Maurer -
zope news