[Zope] Question about <dtml-let ...>

Kevin Carlson khcarlso@bellsouth.net
Wed, 8 May 2002 16:54:33 -0400


George,

The line should read <dtml-let TD_WIDTH="400">.  But I see another problem
and that is that the </dtml-let> tag is right after the <dtml-let> tag.
<dtml-let> alters the namespace by pushing the named expressions on the
namespace stack.  </dtml-let> pops them off the namespace stack.  Since you
are doing both of these together, the namespace will not contain TD_WIDTH
when you need to use it.

Kevin

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
George M. Ellenburg
Sent: Wednesday, May 08, 2002 4:45 PM
To: zope@zope.org
Subject: [Zope] Question about <dtml-let ...>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Okay...

I have a DTML Document called show_tip.

In it, it calls a DTML Method called STYLE_TIP which contains essentially
the
stylesheet for the tool-tip.

In STYLE_TIP, I'm picking a random integer, to show a random background
image,
but am using <dtml-let ...> to create a new variable (called TD_WIDTH) which
I actually need to use from within the main show_tip DTML Document.

 ,----------
| Reason being is because the random backgrounds have different sized images
| embedded in them, and flushed right, so I need to adjust the width of the
| table depending on which image is ultimately picked so the text doesn't
| overwrite the image.
 `----------

Part of the code is as follows:
<dtml-if "imgID==1">
  <dtml-let TD_WIDTH=400></dtml-let>
  background-image: url('/img/TIP-bg-1.png');
</dtml-if>

 ,----------
| If I put quotes around the TD_WIDTH=400 above, I get an invalid paramete
| error when I try to save the DTML method.
 `----------

But, when I go to view show_tip, I get the following:
 Error Type: NameError
 Error Value: global name 'TD_WIDTH' is not defined

The line that's calling it is:
<table border=0 width=<dtml-var TD_WIDTH> align="left">

(I've also tried <dtml-var "TD_WIDTH">, too, but with no luck.)

Can anyone steer me in the right direction?  Could the problem be that the
variable assignation is in a different DTML method from the DTML document
that's calling it?  Should the "400" (in TD_WIDTH=400) be quoted?  I didn't
quote it because I didn't want 400 to be misconstrued as a string, when I
want it to be an integer.

Thanks in advance.
- --
George M. Ellenburg <george@ellenburg.org>
<http://www.ellenburg.org/>
3 Years and counting of being 100% Microsoft-free; and much more productive.
Proud user of ASK <http://www.paganini.net/ask/>, the Active Spam Killer!
- ---
If God had meant for us to be in the Army, we would have been born with
green, baggy skin.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE82Y5FFItzMEWZZdgRAmhhAJ9DZ+pIFDVCeXNe7XqZH0OKtsT9awCfSZPT
DA8l/RYtwiiUwsEVT+bhzyU=
=LY0V
-----END PGP SIGNATURE-----



_______________________________________________
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 )