[Zope] More Calling Dtml-Methods with variable names

Jeremiah White miah34@msn.com
Fri, 22 Jun 2001 22:30:06 -0500


------=_NextPart_001_0000_01C0FB6A.E3418140
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

 OK, I have a small problem now.

This is my main DTML document1:

<dtml-var standard_html_header>
<dtml-var expr=3D"_.getitem(someMethod,1)">
<p> That's all. </p>
<dtml-var standard_html_footer>


Let's say the variable someMethod holds the string 'Method1'.

The DTML Method 'Method1' holds this:

<h1> HELLO </h1>


This actually outputs what you would expect:

'header stuff'
HELLO (bold)
That's all.
'footer stuff'

But what if Method1 is not in the same folder?  For example, if it's in t=
he folder 'Methods' which is in the folder that the main document is in. =
 I can't seem to get that to work.  I've tried this:

<dtml-var expr=3D"_.getitem('Methods.'+someMethod,1)">

and I've tried changing the variable name to 'Methods.Method1', but each =
of these gives me an error:

This resource may be trying to reference a nonexistent object or variable=
 Methods.Method1. =20

Using Methods.Method1() does not make a difference.

If I just put in <dtml-var expr=3D"Methods.Method1()">  it works.  Not wh=
at I want though.

Thanks for you time reading through this message.  I'm really just experi=
menting with Zope right now, trying to learn what it can do and how it ac=
complishes those things.  I have a feeling some experienced Zope users ar=
e laughing hysterically at some of the things I'm doing!

-JeremiahGet more from the Web.  FREE MSN Explorer download : http://expl=
orer.msn.com

------=_NextPart_001_0000_01C0FB6A.E3418140
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>&nbsp;OK, I ha=
ve a small problem now.</DIV> <DIV>&nbsp;</DIV> <DIV>This is my main DTML=
 document1:</DIV> <DIV>&nbsp;</DIV> <DIV>&lt;dtml-var standard_html_heade=
r&gt;</DIV> <DIV>&lt;dtml-var expr=3D"_.getitem(someMethod,1)"&gt;</DIV> =
<DIV>&lt;p&gt; That's all. &lt;/p&gt;</DIV> <DIV>&lt;dtml-var standard_ht=
ml_footer&gt;</DIV> <DIV>&nbsp;</DIV> <DIV>&nbsp;</DIV> <DIV>Let's say th=
e variable someMethod holds the string 'Method1'.</DIV> <DIV>&nbsp;</DIV>=
 <DIV>The DTML Method 'Method1' holds this:</DIV> <DIV>&nbsp;</DIV> <DIV>=
&lt;h1&gt; HELLO &lt;/h1&gt;</DIV> <DIV>&nbsp;</DIV> <DIV>&nbsp;</DIV> <D=
IV>This actually outputs what you would expect:</DIV> <DIV>&nbsp;</DIV> <=
DIV>'header stuff'</DIV> <DIV>HELLO (bold)</DIV> <DIV>That's all.</DIV> <=
DIV>'footer stuff'</DIV> <DIV>&nbsp;</DIV> <DIV>But what if Method1 is no=
t in the same folder?&nbsp; For example, if it's in the folder 'Methods' =
which is in the folder that the main document is in.&nbsp; I can't seem t=
o get that to work.&nbsp; I've tried this:</DIV> <DIV>&nbsp;</DIV> <DIV>&=
lt;dtml-var expr=3D"_.getitem('Methods.'+someMethod,1)"&gt;</DIV> <DIV>&n=
bsp;</DIV> <DIV>and I've tried&nbsp;changing the variable name to 'Method=
s.Method1', but each of these&nbsp;gives me an error:</DIV> <DIV>&nbsp;</=
DIV> <DIV> <LI>This resource may be trying to reference a nonexistent obj=
ect or variable <STRONG>Methods.Method1</STRONG>. </LI></DIV> <DIV>&nbsp;=
</DIV> <DIV>Using Methods.Method1() does not make a difference.</DIV> <DI=
V>&nbsp;</DIV> <DIV>If I just put in &lt;dtml-var expr=3D"Methods.Method1=
()"&gt;&nbsp; it works.&nbsp; Not what I want though.</DIV> <DIV>&nbsp;</=
DIV> <DIV>Thanks for you time reading through this message.&nbsp; I'm rea=
lly just experimenting with Zope right now, trying to learn what it can d=
o and how it accomplishes those things.&nbsp; I have a feeling some exper=
ienced Zope users are laughing hysterically at some of the things I'm doi=
ng!</DIV> <DIV>&nbsp;</DIV> <DIV>-Jeremiah</DIV> <DIV>&nbsp;</DIV> <DIV>&=
nbsp;</DIV> <DIV>&nbsp;</DIV></BODY></HTML><br clear=3Dall><hr>Get more f=
rom the Web.  FREE MSN Explorer download : <a href=3D'http://explorer.msn=
.com'>http://explorer.msn.com</a><br></p>

------=_NextPart_001_0000_01C0FB6A.E3418140--