[Zope] RE: ZopeTime questions (continued)

Martijn Pieters mj@antraciet.nl
Fri, 15 Oct 1999 15:34:59 +0200


At 14:53 15/10/99 , Samu Mielonen wrote:
>Now if I could only do the following (here in dtml-pseudo code)...
>
>   <dtml-with #current_year_taken_from_ZopeTime#>
>     <dtml-with #current_month_taken_from_ZopeTime#>
>       #do my thing#
>   </dtml-with>
>   </dtml-with>
>
>   #current_year_taken_from_ZopeTime# needs to be a number/string, e.g. 1999
>   #current_month_taken_from_ZopeTime# needs to be a number/string, e.g. 10
>   i.e. I don't want the whole timestamp ZopeTime gives, just year or month
>
>...then I'd be a happy camper :)
>
>The following do not work:
>
>         <dtml-with ZopeTime fmt=year> (fmt is not attribute for with?)
>
>         <dtml-with <dtml-var ZopeTime fmt=year> > (I didn't think so :)
>
>         <dtml-call "REQUEST.set('release', ZopeTime fmt=day)> (invalid 
> syntax)

   <dtml-let month="ZopeTime().month()" year="ZopeTime.year()">
     .. here you can use month and year in your code ..
   </dtml-let>

or

   <dtml-call "REQUEST.set('month', ZopeTime().month())">
   <dtml-call "REQUEST.set('year', ZopeTime().year())">

to place them in the REQUEST object.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------