[Zope] Exemple of DTML method with parameters ? [Re: [Zope] newbie - create and call methods ?] and call methods ?]

Eric Simoëns Eric.Simoens@inpg.fr
Thu, 16 Mar 2000 13:54:08 +0100


Olivier Deckmyn wrote:
> 
> What I know is that you have to use Named Parameters in method
> 
> ex:
> myFunction(url, image):
>     return '<A HREF=%s><IMG SRC=%s></A>' % (url, image)
> 
> and the dtml call looks like :
> 
> <dtml-var "myFunction(url='http://www.zope.org', image='logo.gif')">
> 
> I am not sure of all...But I think it is the "spirit"...
> 
> Good luck !

Hello Olivier,

Thank you for your help. The call to the method seems ok, but the code
of the method is displayed instead of been executed. May be is it a
code for external method ? Other things to do instead copying the code
to the DTML method code window in the Zope interface ?

Anyway, could someone please post an exemple of an DTML method
accepting parameters - that is the code to put in the proper windows
in the Zope interface - or a pointer to a document explaining how to
proceed ?

Thanks in advance,
Greetings,
Eric



> ----- Message d'origine -----
> De : Eric Simoëns <Eric.Simoens@inpg.fr>
> À : <zope@zope.org>
> Envoyé : mercredi 15 mars 2000 18:25
> Objet : [Zope] newbie - create and call methods ?
> 
> > Hello all,
> >
> > I've been looking in the available zope documentation, listening to
> > this list, looking in the archive of this list (BTW : are you planning
> > to add a keyword search ?)... That is to say that I'm used to
> > searching for the info about open source OS and applications, but I
> > have to admit I'am almost discouraged using Zope as the doc is really
> > scarse compared with what is usually found.
> >
> > So, sorry, I post my newbie questions :
> >
> > I would like to create a method to generate a link (href) with a
> > leading image and text formatting, and so on. I'd like the method to
> > have two arguments : the name of the link and the URL.
> >
> > How do I create a method with arguments ?
> > How do I call a methods with arguments ?
> > Do I mistake attributes (for docs but not for methods) and arguments ?
> >
> > If you have pointers to documents I haven't found that...
> >
> >
> > Thanks in advance,
> > Greetings,
> > Eric
> >
> >
> > PS: Here is what I tryed:
> > --- DTML method "meth_link"
> > <h2>
> >   <dtml-var img_puce_paragraph>
> >   <a href= "<dtml-var link_url>">
> >   <dtml-var link_name>
> >   </a>
> > </h2>
> >
> > --- in an other method
> > <dtml-var name="meth_link" link_name="foo" link_url="la_url">
> >
> > --- Zope error
> > Invalid attribute name, "link_name", for tag <dtml-var
> > name="meth_link" link_name="foo" link_url="la_url">, on line 6 of
> > txt_user_content
...