I have the following code in my standard_html_header <dtml-unless "id == 'index_html'"> <img src="<dtml-var path>/images/transparent.gif" width=400 height=12 alt=""> <H1 align="center"><dtml-var title></h1> </dtml-unless> The problem is, it displays the <img> and <h1> stuff even when the page that the standard_html_header is being dropped into is index_html. I'm pretty sure I'm missing something really silly here, but if anyone could point it out, I'd really appreciate it. cheers tim
Depending on the object in question id could be a method, so you might want to try: <dtml-unless "id() == 'index_html'"> hth Phil ----- Original Message ----- From: "Tim Hicks" <tim@sitefusion.co.uk> To: <zope@zope.org> Sent: Wednesday, September 13, 2000 12:23 PM Subject: [Zope] Simple dtml-unless problem
I have the following code in my standard_html_header
<dtml-unless "id == 'index_html'"> <img src="<dtml-var path>/images/transparent.gif" width=400 height=12 alt=""> <H1 align="center"><dtml-var title></h1> </dtml-unless>
The problem is, it displays the <img> and <h1> stuff even when the page that the standard_html_header is being dropped into is index_html. I'm pretty sure I'm missing something really silly here, but if anyone could point it out, I'd really appreciate it.
cheers
tim
_______________________________________________ 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 )
On Wed, 13 Sep 2000, Tim Hicks wrote:
<dtml-unless "id == 'index_html'">
Sometimes id is string, sometimes it is a function. <dtml-unless "_['id'] == 'index_html'"> Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
----- Original Message ----- From: "Oleg Broytmann" <phd@phd.russ.ru> To: "Tim Hicks" <tim@sitefusion.co.uk> Cc: <zope@zope.org> Sent: Wednesday, September 13, 2000 12:56 PM Subject: Re: [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote:
<dtml-unless "id == 'index_html'">
Sometimes id is string, sometimes it is a function.
<dtml-unless "_['id'] == 'index_html'">
Thanks very much guys. _['id'] fixed it. tim
Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Wed, 13 Sep 2000, Tim Hicks wrote:
Sometimes id is string, sometimes it is a function.
<dtml-unless "_['id'] == 'index_html'">
Thanks very much guys. _['id'] fixed it.
I hope you understand that I forced Zope to call the id() function, but only if it is function. Else _['id'] just returns the id string. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Wed, 13 Sep 2000, Tim Hicks wrote:
<dtml-unless "id == 'index_html'">
Sometimes id is string, sometimes it is a function. <dtml-unless "_['id'] == 'index_html'"> This is a great example of DTML as a language having a multiple personality disorder. This violates a principle of consistent syntax/semantics. It wants to fool you that you could in fact do <dtml-unless "id == 'index_html'"> but no. I understand why DTML was designed this way, but in attempting to be a very convenient language in syntactic simplicity, it did not do it to completion and there are these traps that many of us learn over long weekends. Early adopters will go through this, but it is a "crossing the chasm" item to be addressed. Regards, Albert Boulanger aboulanger@vpatch.com
----- Original Message ----- From: "albert boulanger" <aboulang@ldeo.columbia.edu> To: <phd@mail2.phd.pp.ru> Cc: <tim@sitefusion.co.uk>; <zope@zope.org> Sent: Wednesday, September 13, 2000 1:45 PM Subject: CASE in point -- [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote:
<dtml-unless "id == 'index_html'">
Sometimes id is string, sometimes it is a function.
<dtml-unless "_['id'] == 'index_html'">
This is a great example of DTML as a language having a multiple personality disorder. This violates a principle of consistent syntax/semantics. It wants to fool you that you could in fact do <dtml-unless "id == 'index_html'"> but no. I understand why DTML was designed this way, but in attempting to be a very convenient
language
in syntactic simplicity, it did not do it to completion and there are these traps that many of us learn over long weekends. Early adopters will go through this, but it is a "crossing the chasm" item to be addressed.
<snip> ----- Original Message ----- From: "Oleg Broytmann" <phd@phd.russ.ru> To: "Tim Hicks" <tim@sitefusion.co.uk> Cc: "Zope Mailing List" <zope@zope.org> Sent: Wednesday, September 13, 2000 1:24 PM Subject: Re: [Zope] Simple dtml-unless problem
On Wed, 13 Sep 2000, Tim Hicks wrote:
Sometimes id is string, sometimes it is a function.
<dtml-unless "_['id'] == 'index_html'">
Thanks very much guys. _['id'] fixed it.
I hope you understand that I forced Zope to call the id() function, but only if it is function. Else _['id'] just returns the id string.
<snip> Thanks Albert and Oleg. If I'm honest, while I have become somewhat familiar with what Albert describes as zope's 'multiple personality disorder', I can't say I truly understand it. I still don't think I've got my head around the _['whatever'] syntax. From what Oleg says, if there is a method there, it will be called, otherwise it reverts to a string! Wow, that sounds like an awkward way to go about things. If I have that point right, how would I force zope to treat it as a string using the _[ syntax? Cheers guys tim
On Thu, 14 Sep 2000, Tim Hicks wrote:
Thanks Albert and Oleg. If I'm honest, while I have become somewhat familiar with what Albert describes as zope's 'multiple personality disorder', I can't say I truly understand it. I still don't think I've got my head around the _['whatever'] syntax. From what Oleg says, if there is a method there, it will be called, otherwise it reverts to a string! Wow, that sounds like an awkward way to go about things. If I have that point right, how would I force zope to treat it as a string using the _[ syntax?
I think you cannot. Probbaly the best you can try is _.getitem("thing", 0) ^ do not render the object Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (4)
-
albert boulanger -
Oleg Broytmann -
Phil Harris -
Tim Hicks