[Zope] How a Method takes argument
Casey Duncan
cduncan@kaivo.com
Wed, 28 Feb 2001 09:46:33 -0700
Sebal wrote:
>
> OK OK ... I'm lost in DTML ...
>
> An easy question : I have a simple list of links like this
>
> <dtml-in expr="objectValues('Image')">
> <a href="imagine"> <dtml-var title> </a>,
> </dtml-in>
>
> and I want the 'imagine' method to print the image selected like this
>
> <dtml-var standard_html_header>
>
> <!--here I put some text-->
> <center><!--here I want the image--></center>
>
> <dtml-var standard_html_footer>
>
> How to do this : I must pass the argument in the link, or 'imagine' can have
> this information
>
> A thousand thanx for some help
> (I used to devellop in C and I work on HTML and ZOPe for only a couple of
> weeks)
You can use acquisition to inherit a method that frames the image.
Create a DTML method called "imagine" somewhere in or above the images
folder.
Put this code in it:
<dtml-var standard_html_header>
<!--here I put some text-->
<center><dtml-var name="tag"></center>
<dtml-var standard_html_footer>
Then in your list method do this:
<dtml-in expr="objectValues('Image')">
<a href="&dtml.url-sequence-item;/imagine"><dtml-var title></a>,
</dtml-in>
This will create a list of links to the image followed by the imagine
method in the URL. This will call the imagine method in the context of
the image. All images have a "tag" method which renders an <img> tag for
itself. Calling this method in imagine puts the tag for the image into
it, inserting the image into the page.
hth
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>