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 images><dtml-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 images><dtml-var image.gif></dtml-with> I did not believe him and tried it out... ... it works in Zope 2.2.2. Dieter
Dieter Maurer wrote:
Then Chris Withers wrote: use
<dtml-with images><dtml-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
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 images><dtml-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 - Zope@zope.org 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 )
participants (3)
-
Chris Withers -
Danny William Adair -
Dieter Maurer