Put the following code in your dtml:
<dtml-calendar> <dtml-var date fmt="%d"> </dtml-calendar>
Phew! that was quick!
You can specify the color of the background:
<dtml-calendar bgcolor="#cc99cc"> <dtml-var date fmt="%d"> </dtml-calendar>
By now, you have probably worked out whatever that goes between the calendar tags get displayed in each cell.
The following example puts a link on dates less than 14 :
<dtml-calendar bgcolor="#cc99cc"> <dtml-if "_int(date.dd())<14"> <a href="http://www.zope.org"><dtml-var date fmt="%d"></a> </dtml-else> <dtml-var date fmt="%d"> </dtml-if> </dtml-calendar>
So the toolbar is a bit ugly, but you are no artist either. Let's turn the toolbar off:
<dtml-calendar controls=no> <dtml-var date fmt="%d"> </dtml-calendar>
A trivial task with the calendar tag:
<dtml-calendar images=no> <dtml-var date fmt="%d"> </dtml-calendar>
The weekdays attribute takes two digits, the first digit between 0 and 6, the second digit between 1 and 9. Kids, do try this at home:
<dtml-calendar weekdays=37> <dtml-var date fmt="%d"> </dtml-calendar>
Notice that the week begins on Wednesday now? And try this too:
<dtml-calendar weekdays=35> <dtml-var date fmt="%d"> </dtml-calendar>
Built-in internationalization:
<dtml-calendar lang=es> <dtml-var date fmt="%d"> </dtml-calendar>
Other languages you can use are: ca, da, de, du, en, es, eu, fi, fr, it, ja, no, pl, pt, ro, ru, zh_TW.
You can still make the calendar show in language setting the following properties with setCalendar:
In the last four properties, you can use the following parameters:
For example, this bit of code will show a calendar with texts and date formats in basque:
<dtml-calendar weekdays="17" theme="yb"> <dtml-call "setCalendar('monthnames',['Urtarrila','Otsaila','Martxoa','Apirila','Maiatza','Ekaina','Uztaila','Abuztua','Iraila','Urria','Azaroa','Abendua'])"> <dtml-call "setCalendar('shortmonthnames',['Urt','Ots','Mar','Api','Mai','Eka','Uzt','Abu','Ira','Urr','Aza','Abe'])"> <dtml-call "setCalendar('daynames',['Ig','Al','Aa','Az','Og','Or','La'])"> <dtml-call "setCalendar('longmonth_year_format','yyyy(e)ko mmmm')"> <dtml-call "setCalendar('shortmonth_year_format','yyyy/mmm')"> <dtml-call "setCalendar('month_day_year_format','yyyy(e)ko mmmmren dda')"> <dtml-call "setCalendar('week_format','ww. astea')"> <dtml-var date fmt="%d"> </dtml-calendar>
Some other properties you can use with setCalendar to change its look and feel:
000000
).000000
.bordercolor
. Defaults to 2.setCalendar('cellattrs', (('CLASS','day'), ('ID','today')))
Try this for example:
<dtml-calendar mode="month" weekdays="17"> <dtml-if "date.dow()==6 or date.dow()==0"> <dtml-call "setCalendar('cellbgcolor', '#ff0000')"> <dtml-else> <dtml-call "setCalendar('cellbgcolor', '#ffffff')"> </dtml-if> <dtml-var date fmt="%d"> </dtml-calendar>
At the moment there is only the "yb" theme:
<dtml-calendar theme=yb> <dtml-var date fmt="%d"> </dtml-calendar>