Re: [Zope] images in directories
I have a similar situation where I find myself way down in the tree structure and have to go up to a certain point and down again. Leaving "bad structuring" aside (actually its well structured in many other respects), all I could think of to get a hold of these objects was a whole bunch of nested "with" statements. They suck. Now what's with your PathHandler product? How would an appropriate method look like? I was thinking of a "walk2object" method rather than "showImage"... see I don't want to start at "/", I want to start whereever I like at that moment and still take the "/"-separated path info to "walk" to my object. I think this has more to do with elegance than with lazyness. (tho these two know each other very well ;-) ) tia, Danny Dieter Maurer wrote: Then Chris Withers wrote: use dtml-with imagesdtml-var image.gif/dtml-with I did not believe him and tried it out... ... it works in Zope 2.2.2. ...worked for me all the way back to 2.1.4 ;-) Anyway, if you're _really_ lazy, write an external method something alogn the lines of: def showImage(self,path): return self.restrictedTraverse(path)(self,self.REQUEST) ...then, in your dtml, you can do: dtml-var "showImage('/images/image.gif')" This is all totally untested of course ;-) I've often wondered why this isn't built into DTML so that you could do: dtml-var /folder/myobject obviously, you wouldn't be able to do this with stuf inside " " ;-) cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
Dieter Maurer wrote: Then Chris Withers wrote: use dtml-with imagesdtml-var image.gif/dtml-with I did not believe him and tried it out... ... it works in Zope 2.2.2. ...worked for me all the way back to 2.1.4 ;-) Anyway, if you're _really_ lazy, write an external method something alogn the lines of: def showImage(self,path): return self.restrictedTraverse(path)(self,self.REQUEST) ...then, in your dtml, you can do: dtml-var "showImage('/images/image.gif')" This is all totally untested of course ;-) I've often wondered why this isn't built into DTML so that you could do: dtml-var /folder/myobject obviously, you wouldn't be able to do this with stuf inside " " ;-) cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] images in directories
I was sort of hoping it would be easier. It would be ideal to have this: dtml-with imagesdtml-var image.gif/dtml-with boiled down to one simple tag that works when I store images in a subfolder *and* use file extensions. But from what I've read so far, it can't be done... Someone suggested the following: dtml-var "images.getitem('image.gif',1)" but that didn't work for some reason, and still seems a little complex for just inserting an image. Pete -- Subject: Re: [Zope] images in directories hi, Sure they are. If you ftp a jpg to the server it comes up with an id of bla.jpg, you can then refrence it in html just like you would on an Apache server or whaterver img src="../../bla.jpg" ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] images in directories
Pete Prodoehl writes: I was sort of hoping it would be easier. It would be ideal to have this: dtml-with imagesdtml-var image.gif/dtml-with boiled down to one simple tag that works when I store images in a subfolder *and* use file extensions. But from what I've read so far, it can't be done... I had this opinion till some days ago. Then Chris Withers wrote: use dtml-with imagesdtml-var image.gif/dtml-with I did not believe him and tried it out... ... it works in Zope 2.2.2. Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
Pete Prodoehl wrote: Is it possible to have an image named "image.gif" or "image.jpg" ? (Are file extensions allowed? If so, how are those objects addresses?) dtml-with IMAGES dtml-var image.gif /dtml-with or dtml-var "IMAGES.getitem('image.gif',1)" cheers, Chris Pete -- "Farrell, Troy" wrote: dtml-with IMAGES dtml-var image1 /dtml-with This also works: dtml-var "IMAGES.image1" ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
hi, Sure they are. If you ftp a jpg to the server it comes up with an id of bla.jpg, you can then refrence it in html just like you would on an Apache server or whaterver img src="../../bla.jpg" j. .. . Jason C. Leach ... University College of the Cariboo. .. On Mon, 6 Nov 2000, Chris Withers wrote: Pete Prodoehl wrote: Is it possible to have an image named "image.gif" or "image.jpg" ? (Are file extensions allowed? If so, how are those objects addresses?) dtml-with IMAGES dtml-var image.gif /dtml-with or dtml-var "IMAGES.getitem('image.gif',1)" cheers, Chris Pete -- "Farrell, Troy" wrote: dtml-with IMAGES dtml-var image1 /dtml-with This also works: dtml-var "IMAGES.image1" ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] images in directories
Pete Prodoehl writes: Is it possible to have an image named "image.gif" or "image.jpg" ? (Are file extensions allowed? If so, how are those objects addresses?) It is. And it is quite common. There is a minor problem, if you like to put images in an "image" folder. But this is not related to filename extensions. Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] images in directories
Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
When you create your image object set the path correctly then your dtml-var image1 should work :) Dan CURTIS David wrote: Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
David, dtml-var "IMAGES.image1" Where image1 is in the folder IMAGES. -Aaron At 07:42 AM 11/2/00 -0800, CURTIS David wrote: Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
CURTIS David a écrit : Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance You can use the dtml-with tag on the folder IMAGES (because it's an object) like that : dtml-width IMAGES ... dtml-var image1 ... dtml-var image2 ... /dtml-width but it's a bit boring... ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] images in directories
Aha! Acquisition! http://www.zope.org/Members/Amos/WhatIsAcquisition Assuming that IMAGES is a subfolder of the PWD, try this (untested): dtml-with IMAGES dtml-var image1 /dtml-with Also look here: http://www.zope.org/Members/michel/HowTos/WithTagHow-To Troy What is a fool that has no money? -Original Message- From: CURTIS David [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 02, 2000 9:42 AM To: [EMAIL PROTECTED] Subject: [Zope] images in directories Sensitivity: Personal Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
"Farrell, Troy" wrote: dtml-with IMAGES dtml-var image1 /dtml-with This also works: dtml-var "IMAGES.image1" Petr van Blokland [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] images in directories
Is it possible to have an image named "image.gif" or "image.jpg" ? (Are file extensions allowed? If so, how are those objects addresses?) Pete -- "Farrell, Troy" wrote: dtml-with IMAGES dtml-var image1 /dtml-with This also works: dtml-var "IMAGES.image1" ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] images in directories
hi This is a bit of code I was working on, it may not be what you are after but: dtml-in expr="PARENTS[0].objectValues('Image')" lidtml-var title_or_idbr/li img src="dtml-var id"brbrbr /dtml-in It scans through a Folder and displays all the images it finds. If that's not what you want, then the last line img src="dtml-var id" is probably what you want. With OOP Images know how to display themselves, so all you need to do is call there ID. Also, the PARENTS[0] allows you to go backwards through parent folders 0 is the folder you script is in, 1 is one level back and so on. j. .. . Jason C. Leach ... University College of the Cariboo. .. On 2 Nov 2000, CURTIS David wrote: Hi, I check the archives but could not find an answer. How do you display images that are burried in directories? For example, dtml-var image1 works with the image1 at same level but dtml-var /IMAGES/image1 does not. nor does dtml-var IMAGES/image1 Any help would be apprechiated. Thanks in advance ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )