Martijn Pieters wrote From Zope 2.0b1 you can also call the 'tag' method on the image object, specifying the width and height that should be in the IMG tag generated, or specify that no with or height attributes should be present: <dtml-var "MyImage.tag(width='', height='')"> will get you a IMG tag that won't have width and height attributes.
now if only someone would add a 'inputtag' method, which would make it output the magic for '<input type="image">' with the image... (... it would take one more thing of my to-do list :) Anthony
At 12:02 04/08/99 , Anthony Baxter wrote:
now if only someone would add a 'inputtag' method, which would make it output the magic for '<input type="image">' with the image...
The official spec doesn't mention any HEIGHT and WIDTH attributes, so we'd only default the alt attribute. Note that neither Netscape Navigator or MS Internet Explorer claim to know about the ALT attribte, at least not according to their online HTML references. The code then would be: def inputtag(self, alt=None, **args): """ Generate an HTML INPUT type=image tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an INPUT tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'alt'. """ string='<input type=image src="%s"' % (self.absolute_url()) if alt==None: alt=self.title_or_id() if alt: string = '%s alt="%s"' % (string, alt) for key in args.keys(): value = args.get(key) string = '%s %s="%s"' % (string, key, value) return string + '>' Place this around line 483 of Image.py (Zope 2.0b1) and you can call: <dtml-var "MyImage.inputtag(name='SubmitImg', tabindex=5, align='top')> Apparently the INPUT type=image can also take the 'usemap' attribute, but how this is meant to work I don't know (see HTML 4.0 spec, http://www.w3.org/TR/REC-html40, section 17.4). -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
At 12:43 04/08/99 , Anthony Baxter wrote: def inputtag(self, alt=None, **args):
""" Generate an HTML INPUT type=image tag for this image, with customization. Arguments to self.tag() can be any valid attributes of an INPUT tag. 'src' will always be an absolute pathname, to prevent redundant downloading of images. Defaults are applied intelligently for 'alt'. """
Oops, that should be 'Arguments to self.inputtag() -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (2)
-
Anthony Baxter -
Martijn Pieters