What am I doing wrong here? <dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine <dtml-if "id == last"> this one! </dtml-if> i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same they are never equal! thanks, mike
I have never been able to do that either and always wondered how to do it. However I have a workaround that I use frequently. I just use the title instead, which works perfectly. <dtml-if "title == 'My Page' ">This one!</dtml-if> Greg On 8/28/05, michael <michael@tropolinux.com> wrote:
What am I doing wrong here?
<dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine
<dtml-if "id == last"> this one! </dtml-if>
i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same
they are never equal!
thanks, mike
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Greg Fischer 1st Byte Solutions http://www.1stbyte.com
Thanks for your reply, that is half way there, I want to compare two variables though. where as 'my page' is constant, and hard coded in. someone's gotta know :-) mike Greg Fischer wrote:
I have never been able to do that either and always wondered how to do it. However I have a workaround that I use frequently. I just use the title instead, which works perfectly.
<dtml-if "title == 'My Page' ">This one!</dtml-if>
Greg
On 8/28/05, michael <michael@tropolinux.com> wrote:
What am I doing wrong here?
<dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine
<dtml-if "id == last"> this one! </dtml-if>
i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same
they are never equal!
thanks, mike
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Try calling id then comparing it. <dtml-if "id()==last"> this one! </dtml-if> -- David On Aug 28, 2005, at 7:19 PM, michael wrote:
Thanks for your reply, that is half way there, I want to compare two variables though. where as 'my page' is constant, and hard coded in.
someone's gotta know :-)
mike
Greg Fischer wrote:
I have never been able to do that either and always wondered how to do it. However I have a workaround that I use frequently. I just use the title instead, which works perfectly.
<dtml-if "title == 'My Page' ">This one!</dtml-if>
Greg
On 8/28/05, michael <michael@tropolinux.com> wrote:
What am I doing wrong here?
<dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine
<dtml-if "id == last"> this one! </dtml-if>
i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same
they are never equal!
thanks, mike
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Thanks thats it! Why is it like that? m David Siedband wrote:
Try calling id then comparing it.
<dtml-if "id()==last"> this one! </dtml-if>
-- David
On Aug 28, 2005, at 7:19 PM, michael wrote:
Thanks for your reply, that is half way there, I want to compare two variables though. where as 'my page' is constant, and hard coded in.
someone's gotta know :-)
mike
Greg Fischer wrote:
I have never been able to do that either and always wondered how to do it. However I have a workaround that I use frequently. I just use the title instead, which works perfectly.
<dtml-if "title == 'My Page' ">This one!</dtml-if>
Greg
On 8/28/05, michael <michael@tropolinux.com> wrote:
What am I doing wrong here?
<dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine
<dtml-if "id == last"> this one! </dtml-if>
i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same
they are never equal!
thanks, mike
Am Montag, den 29.08.2005, 14:08 +1000 schrieb michael:
Thanks thats it! Why is it like that?
...
On 8/28/05, michael <michael@tropolinux.com> wrote:
What am I doing wrong here?
<dtml-var last> -- this prints out the variable sent from last (referring) page fine <dtml-var id> -- this prints out the id of the current item fine
<dtml-if "id == last"> this one! </dtml-if>
i want this to output "this one!" when the current item is the one requested by the last page but they are never seen as == even when the two dtml-var are the same
they are never equal!
You will see this in the list archives several times in the past. Depending on the object, id is a method and not an simple attribute. To be on the save side (instead of figuring out what it is actually) always use: getId() Btw. <dtml-var id> does not use the id the same way like <dtml-if "id==last">. Try <dtml-var "id"> and you will see the method signature (view document source in the browser) I'd recommend doing that all in a python script and then use the prepared data in your DTML - oder later ZPT.
participants (4)
-
David Siedband -
Greg Fischer -
michael -
Tino Wildenhain