[Zope] Newbie or beyond me?

Jatwood@bwanazulia.com Jatwood@bwanazulia.com
Sat, 5 Feb 2000 22:20:29 -0500


Thanks Chris for the help... I now can explain the whole problem.

I had created a folder "foldername" and in it I created a few DTML 
Methods (methodname1, methodname2, methodname3). I was getting back a 
variable from a sql call "variablename" (above the folder) and I was 
trying to get some of the values stated in those methods in the 
folder. So I was using...

<DTML-VAR "foldername.method1">

And in those method (or so the thinking went) I could store the link 
and replace the variables like you described below but it would only 
give back the actual whole method not the some of values defined in 
the method itself.

Again, I knew this is as newbie as they get but even with some Python 
background I am getting a bit confused.

I am having a great time though... Feeling the Zen.

JMA


At 7:49 PM -0500 2/5/00, Chris McDonough wrote:
>You can do something like this:
>
>The following REQUEST.set's are only necessary to have some placeholder
>variables, you'd probably get the values from somewhere else, maybe a
>property on a folder, or a form value, or a SQL field, whatever.
>
><dtml-call expr="REQUEST.set('v1', 'Members')"> # equivalent to Python's
>"v1 = 'Members'"
><dtml-call expr="REQUEST.set('v2', 'ZQR')"> # equivalent to Python's "v2
>= 'ZQR'"
>
><A HREF="http://www.zope.org/<dtml-var v1>/<dtml-var v2>">
>
>to make it look a little nicer, you can also use DTML "entity syntax":
>
><A HREF="http://www.zope.org/&dtml-v1;/&dtml-v2;">
>
>You could even do something like this:
>
><dtml-call expr="REQUEST.set('myURL', 'http://www.zope.org/%s/%s' % (v1,
>v2))">
><dtml-var myURL>
>
>Jatwood@bwanazulia.com wrote:
>  >
>  > Here is the question (after a few too many hours of messing with this)
>  >
>  > I am trying to figure out the best way to populate links with
>  > variables. In raw python I would just declare the links like
>  >
>  > link =  "<a href="http://www.somewhere.com/cgi/%(v1)s/somthingelse/%(v2)s "
>  >
>  > and populate the link with tuples  when I was going to use it.
>  >
>  > link % variable
>  >
>  > For the life of me I can't figure out how to do this in Zope. Any
>  > help would be great.
>  >
>  > I am sure this is easy but I am at a complete loss.
>  >
>  > Thanks,
>  > JMA
>  >
>  > _______________________________________________
>  > Zope maillist  -  Zope@zope.org
>  > http://lists.zope.org/mailman/listinfo/zope
>  > **   No cross posts or HTML encoding!  **
>  > (Related lists -
>  >  http://lists.zope.org/mailman/listinfo/zope-announce
>  >  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>--
>Chris McDonough
>Digital Creations, Inc.
>Zope - http://www.zope.org
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )