This should be simplicity itself but I've read and re-read what the Zope book has to say on this and I don't understand... <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png"> should, if my understanding is correct, replace the src attribute for the image with the path defined by the tal:attributes statement. My understanding is wrong because I get: <img src="<img src="http://127.0.0.1:8080/ldml/images/ldmlMenu_01.png" alt="" title="" height="2" width="170" border="0" />" width="170" height="2" border="0"> To put this in context, this snippet is contained in a format file which is included in a number of other files. Not knowing better I've used the construct: <div id="menuMain" tal:replace="structure here/main_menu"> ...placeholder code... </div> to include this although I understand that I should use Macros to include this. I'll change this shortly. It looks as if... No I wont embarrass myself further. Would someone explain what's going on here and where my understanding is wrong. TIA Simon Forster ___________________________________________________ LDML Ltd, Office One, 16 Canham Road, London, W3 7SR, UK Tel: +44 (0)20 8749 7766 Fax: +44 (0)70 9230 5247 ___________________________________________________
On Wed, Jun 18, 2003 at 08:05:06PM +0100, Simon Forster wrote:
This should be simplicity itself but I've read and re-read what the Zope book has to say on this and I don't understand...
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png">
should, if my understanding is correct, replace the src attribute for the image with the path defined by the tal:attributes statement. My understanding is wrong because I get:
<img src="<img src="http://127.0.0.1:8080/ldml/images/ldmlMenu_01.png" alt="" title="" height="2" width="170" border="0" />" width="170" height="2" border="0">
yup. when you call the image, you get a complete img tag. And when you insert text in tal, it gets quoted unless you use "structure". So you could do a couple of things: 1. Get the url instead of the complete tag: <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png/absolute_url"> 2. Use the complete tag: <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:replace="structure here/images/ldmlMenu_01.png"> or <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:replace="structure here/images/ldmlMenu_01.png/tag"> -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's YET ANOTHER TITANIUM BONER ELECTROCUTOR! (random hero from isometric.spaceninja.com)
On Wednesday, June 18, 2003, at 05:04 pm, Paul Winkler wrote:
yup. when you call the image, you get a complete img tag.
So how do I find out tidbits like that?
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png/absolute_url">
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:replace="structure here/images/ldmlMenu_01.png/tag">
And the methods for the image object? Is there a definitive reference for all these objects? TIA Simon Forster ___________________________________________________ LDML Ltd, Office One, 16 Canham Road, London, W3 7SR, UK Tel: +44 (0)20 8749 7766 Fax: +44 (0)70 9230 5247 ___________________________________________________
yup. when you call the image, you get a complete img tag.
So how do I find out tidbits like that?
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png/absolute_url">
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:replace="structure here/images/ldmlMenu_01.png/tag">
And the methods for the image object? Is there a definitive reference for all these objects?
The *definitive* reference is [drumroll] the source. If you read the source -- even just the method definitions -- of the Image object (which is, by the way, is with File in OFS/Image.py) and its parents, you will know exactly what it can do. And yes, I know that's not what you wanted to hear. The Zope API reference, either from the online help system or from the appendicies of the Zope Book, is often very useful. In the case of the Image, it would have told you exacty what you wanted to know. In other cases it is less than useful, such as with the fictional ObjectManagerItem. Perhaps by fiddling with pydoc or DocFinderEverywhere we can get a better API reference. I haven't tried yet. --jcc
Simon: The tal:attributes="src here/images/ldmlMenu_01.png" is actually replacing src with the default view of an image which is the html tag itself. An *easier* way of doing what you want to do would be: <img src="#" alt="#" tal:replace="structure here/images/ldmlMenu_01.png" /> This will replace the <img [...]> tag with <img src="http://127.0.0.1:8080/ldml/images/ldmlMenu_01.png" alt="" title="" height="2" width="170" border="0" /> The tal:replace command replace whatever tag it resides in. The "structure [...]" will tell Zope not to escape characters (ie " == "). hth, Andrew Williams "Simon Forster" <simon-lists@ldml.com> wrote in message news:C62CE791-A1BF-11D7-9ACC-000A9579123A@ldml.com...
This should be simplicity itself but I've read and re-read what the Zope book has to say on this and I don't understand...
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png">
should, if my understanding is correct, replace the src attribute for the image with the path defined by the tal:attributes statement. My understanding is wrong because I get:
<img src="<img src="http://127.0.0.1:8080/ldml/images/ldmlMenu_01.png" alt="" title="" height="2" width="170" border="0" />" width="170" height="2" border="0">
To put this in context, this snippet is contained in a format file which is included in a number of other files. Not knowing better I've used the construct:
<div id="menuMain" tal:replace="structure here/main_menu"> ...placeholder code... </div>
to include this although I understand that I should use Macros to include this. I'll change this shortly.
It looks as if...
No I wont embarrass myself further. Would someone explain what's going on here and where my understanding is wrong.
TIA
Simon Forster ___________________________________________________ LDML Ltd, Office One, 16 Canham Road, London, W3 7SR, UK Tel: +44 (0)20 8749 7766 Fax: +44 (0)70 9230 5247 ___________________________________________________
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Simon Forster wrote:
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png">
should, if my understanding is correct, replace the src attribute for the image with the path defined by the tal:attributes statement.
Calling an Image gives you a complete <img> tag for that image. To do what you want, use either of these: <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png/absolute_url"> <img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:replace="structure here/images/ldmlMenu_01.png"> Cheers, Evan @ 4-am
This should be simplicity itself but I've read and re-read what the Zope book has to say on this and I don't understand...
<img src="../images/ldmlMenu_01.png" width="170" height="2" border="0" tal:attributes="src here/images/ldmlMenu_01.png">
should, if my understanding is correct, replace the src attribute for the image with the path defined by the tal:attributes statement. My understanding is wrong because I get:
<img src="<img src="http://127.0.0.1:8080/ldml/images/ldmlMenu_01.png" alt="" title="" height="2" width="170" border="0" />" width="170" height="2" border="0">
Just to add to the pile... if you really wanted that very string to be used (and you don't, you want the path, which is a method on that object), you would say something like <img src="../images/ldmlMenu_01.png" tal:attributes="src string:here/images/ldmlMenu_01.png"> to keep it from being interpreted by Zope. Not that this is used much, but still. --jcc
participants (5)
-
Andrew Williams -
Evan Simpson -
J Cameron Cooper -
Paul Winkler -
Simon Forster