[Zope] Using a generated image map

Peter Bengtsson mail@peterbe.com
Tue, 27 May 2003 15:39:14 +0100


At 15:21 2003-05-27 +0200, Yves Bastide wrote:
>Peter Bengtsson wrote:
>>At 08:52 2003-05-27 +0200, Yves Bastide wrote:
>>
>>>Peter Bengtsson wrote:
>>>
>>>>At 15:49 2003-05-26 +0200, Yves Bastide wrote:
>>>>
>>>>>Hi,
>>>>>
>>>>>I've got a script which generates both an image and an image map.
>>>>>How to  use them from a ZPT?  (The problem: the image must be passed 
>>>>>"by reference", and the map "by value")
>>>>
>>>>
>>>>Do it the easy way:
>>>><h3> My imagemap </h3>
>>>><img tal:replace="structure here/getMyImage" />
>>>><p tal:replace="structure here/getMyImageMap" > Here goes the imagemap 
>>>>html stuff</p>
>>>>Using the power of ZPT for these kinds of small things is overhead.
>>>
>>>
>>>The problem is that the image and the map are generated by one quite 
>>>costly script (with database accesses and such)...
>>
>>The problem isn't with ZPT. I showed you how to access them, not how to 
>>store or generate them.
>>ZPT's just stich together certain elements and generates a HTML output.
>>So what's the problem?
>
>OK, I'll try to be clearer.  _The same_ script does the image and the 
>map.  If images were inlined in HTML, I'd write something like
>
><div tal:define="img_and_map here/generateImageAndMap">
>   <img tal:content="img_and_map/img" usemap="#mymap"/>
>   <map name="mymap" tal:replace="structure img_and_map/map"></map>
></div>

Looks good. But you've got the tal:content and tal:replace the wrong way 
around.