<!--#var dir/name not possible?
Hi, I like to keep my image files in a directory "img". How can I call image files from lower levels? I tried <!--#var img/name--> and it did not work, but when I use <img src="img/name"> it works nicely... How do I do this with #var ? -- Milos Prudek
On Sun, 14 Mar 1999, Milos Prudek wrote:
I like to keep my image files in a directory "img". How can I call image files from lower levels? I tried <!--#var img/name--> and it did not
<!--# var "img.name"--> should do it but your second method I think is better.
work, but when I use <img src="img/name"> it works nicely... How do I do this with #var ?
Pavlos
At 09:53 15/03/99 , Milos Prudek wrote:
<!--# var "img.name"--> should do it but your second method I think is better.
Yes, this works. Quotes helped.
Now, how can I add border=0 ?
Yep, you got use there.... calling the Image object doesn't generate extra information like border=0. DC is working on a solution to that, at least, I think they said so. For now you will have to write out the IMG tag yourself: <IMG SRC="<!--#var BASE1-->/img/name" width="<!--#var "img.name.width"-->" height="<!--#var "img.name.height"-->" border=0> I assumed that the img Folder object is a direct subobject of the Zope root object. -- M.J. Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Yep, you got use there.... calling the Image object doesn't generate extra
I was afraid it would be the case.... I thought I could use Property somehow (adding text Property named Border with the value 0) but then I realized that I can't interfere with it, since the rendering takes place INSIDE while properties are OUTSIDE.
<IMG SRC="<!--#var BASE1-->/img/name" width="<!--#var "img.name.width"-->"
Looks terrible :-) I think I rather use <img src=img/name border=0> for the time being. -- Milos Prudek
On Sun, 14 Mar 1999, Milos Prudek wrote:
Hi,
I like to keep my image files in a directory "img". How can I call image files from lower levels? I tried <!--#var img/name--> and it did not work, but when I use <img src="img/name"> it works nicely... How do I do this with #var ?
I think you need <!--#var img.name-->. I haven't tested this, so I'm not sure it works, but I am 99% sure this is what you're going for.
Milos Prudek
jkh
I think you need <!--#var img.name-->.
I haven't tested this, so I'm not sure it works, but I am 99% sure this is
It doesn't work.
what you're going for.
Yes, that's what I want. Maybe what I'm trying to do is against object-oriented concept? I can see that images should be kept with the DTML page that calls them. I just need images to be accessible by a group (role) of "image managers", but the code that holds it to together should be accessible to an Admin role only. -- Milos Prudek
On 15-Mar-99 Jeff K. Hoffman wrote:
I think you need <!--#var img.name-->.
okay next qustion: I have a image under a folder called "images". <!--#var "images.somefilename"--> should work - except that the image filename contains the "." character (eg: "foo.gif") and this gets confused with the dot notation of the object (it tries to find images/foo/gif and chokes with a traceback) So how do I get round this one? --- Julian Morrison Programmer (Zereau Ltd)
<!--#var "images.somefilename"--> should work - except that the image filename contains the "." character (eg: "foo.gif") and this gets confused
Object name can be different from filename. Thus you name your foo.gif file just Foo, and that's it. -- Milos Prudek
At 05:38 PM 3/15/99 +0100, Milos Prudek wrote:
<!--#var "images.somefilename"--> should work - except that the image filename contains the "." character (eg: "foo.gif") and this gets confused
Object name can be different from filename. Thus you name your foo.gif file just Foo, and that's it.
Or, if you absolutely must have '.' in the filename, try: <!--#with images--><!--#var foo.gif--><!--#/with-->
At 12:16 PM 3/15/99 -0000, julian@zereau.net wrote:
On 15-Mar-99 Jeff K. Hoffman wrote:
I think you need <!--#var img.name-->.
okay next qustion: I have a image under a folder called "images". <!--#var "images.somefilename"--> should work - except that the image filename contains the "." character (eg: "foo.gif") and this gets confused with the dot notation of the object (it tries to find images/foo/gif and chokes with a traceback)
In general, when you have trouble spelling an object's name in a variable expression because its name is not a legal Python name (e.g. 'sequence-item' or 'foo.gif') then you should use _[] or _.getitem However in your case you can simply get the sub-object with a plain old getattr: <!--#var "_.getattr(images,'foo.gif')"--> Another possibility is to use the with tag: <!--#with images--> <!--#var foo.gif--> <!--#/with--> Since these are so ugly, you might consider the simpler manual method of generating the img tag: <img src="images/foo.gif"> or else you might consider *not* having a images directory, and keeping your images in the Folders where they're used. Then you can refer to the images directly: <!--#var foo.gif--> And because of acquisition, foo.gif is accessible to all sub-Folders of the Folder it is located in, in the same way. -Amos
At 20:57 14/03/99 , Milos Prudek wrote:
Hi,
I like to keep my image files in a directory "img". How can I call image files from lower levels? I tried <!--#var img/name--> and it did not work, but when I use <img src="img/name"> it works nicely... How do I do this with #var ?
<!--#var "img.name"--> is the best way to go. It'll insert a IMG tag with an absolute URL, and if it knows the image width and height, these will be included in the image tag. Make sure you use the quotes! img.name means: the attribute 'name' of the object called 'img'. You can specify the image width and height by hand in the images' property screen, but if you uploaded a PNG or GIF image, Zope will deduce the width and height from the image itself. The next Zope release will also support JPEG image size detection. -- M.J. Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (7)
-
Amos Latteier -
Jeff K. Hoffman -
julian@zereau.net -
Martijn Pieters -
Milos Prudek -
Pavlos Christoforou -
Phillip J. Eby