I would like, within a ZPT to get a global variable called 'now' to the present date and time. I can do this in dtml with <dtml-call "REQUEST.set('now', ZopeTime())"> but how do I do I it in TAL ? This was my guess : <span tal: define="now string: ZopeTime()"> but it wasn't correct :( Kate
--On Montag, 17. November 2003 9:58 Uhr -0500 Kate Legere <klegere@kfpl.ca> wrote:
This was my guess : <span tal: define="now string: ZopeTime()"> but it wasn't correct :(
Try "python:" instead of "string:" (no idea why you think that "string:" will do the job?! -aj
Try this: <span tal:define="now python:here.ZopeTime"> <b tal:replace="now"/> </span> dragos ----- Original Message ----- From: "Kate Legere" <klegere@kfpl.ca> To: "Zope" <zope@zope.org> Sent: Monday, November 17, 2003 4:58 PM Subject: [Zope] example ?
I would like, within a ZPT to get a global variable called 'now' to the present date and time.
I can do this in dtml with <dtml-call "REQUEST.set('now', ZopeTime())"> but how do I do I it in TAL ? This was my guess : <span tal: define="now string: ZopeTime()"> but it wasn't correct :(
Kate
_______________________________________________ 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 )
Dragos Chirila wrote at 2003-11-17 16:57 +0200:
Try this:
<span tal:define="now python:here.ZopeTime"> <b tal:replace="now"/> </span>
It might even be better to use "now python:here.ZopeTime()" instead of "now python:here.ZopeTime". "ZopeTime" is a method. When you bind the method to "now", it is called each time "now" is rendered. This is at least an unnecessary overhead. It may also give you different results in the same request (as the time progresses). -- Dieter
participants (4)
-
Andreas Jung -
Dieter Maurer -
Dragos Chirila -
Kate Legere