-----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-----
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 )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 08 May 2002 04:54 pm, Kevin Carlson wrote:
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
Gotcha. So I take it there's no variable typing? "400" is both a string and an integer? Hmmm... would <!--#let TD_WIDTH="400"--> work better, or can I just put the </dtml-let> on the line right below it? Thanks for the advice! - -- 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! - --- Any philosophy that can be put in a nutshell belongs there. -- Sydney J. Harris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE82ZK6FItzMEWZZdgRAhKwAJ9XudARfkYdz0/hlrUVAtis5D1YZACdEY55 0BXY3LuGDvJjRVCiW7a4Ca0= =OPYN -----END PGP SIGNATURE-----
Hi George, I don't think that the <!--#let TD_WIDTH="400"--> line will work at all since it will be interpreted as a comment. And yes, you can put the </dtml-let> right below the <dtml-let>. The key is to put the code that needs to reference TD_WIDTH between those two tags. Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of George M. Ellenburg Sent: Wednesday, May 08, 2002 5:04 PM To: Kevin Carlson; zope@zope.org Subject: Re: [Zope] Question about <dtml-let ...> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 08 May 2002 04:54 pm, Kevin Carlson wrote:
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
Gotcha. So I take it there's no variable typing? "400" is both a string and an integer? Hmmm... would <!--#let TD_WIDTH="400"--> work better, or can I just put the </dtml-let> on the line right below it? Thanks for the advice! - -- 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! - --- Any philosophy that can be put in a nutshell belongs there. -- Sydney J. Harris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE82ZK6FItzMEWZZdgRAhKwAJ9XudARfkYdz0/hlrUVAtis5D1YZACdEY55 0BXY3LuGDvJjRVCiW7a4Ca0= =OPYN -----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 )
George M. Ellenburg writes:
Gotcha. So I take it there's no variable typing? "400" is both a string and an integer? The "400" in
<dtml-let TD_WIDTH="400"> is an integer and not a string. Unlike in Python Script, the "..." does not indicate a string but a Python expression context. To get the string "400", you would use <dtml-let TD_WIDTH="'400'">
... Hmmm... would <!--#let TD_WIDTH="400"--> work better, or can I just put the </dtml-let> on the line right below it? There is no difference (in function) between "<!--#let ..." and "dtml-let". The former is just the older SSI (Server Side Include) syntax.
Dieter
George M. Ellenburg writes:
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. This will not work with "dtml-let", use "REQUEST.set". See either in the mailing list archives or (e.g.)
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> to find out more. Dieter
participants (3)
-
Dieter Maurer -
George M. Ellenburg -
Kevin Carlson