From 870963df2dac72e433fd7f94cd1cccc8cd6ea2d0 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Wed, 02 Feb 2005 22:30:27 +0000 Subject: 1. changed version to -svn 2. added a really simple page example 3. removed 'border=' attribute from iframe 4. added notice about svn version 5. added 'site-C-ing:' prefix to the title --- (limited to 'htdocs/examples') diff --git a/htdocs/examples/calendar.chtml b/htdocs/examples/calendar.chtml new file mode 100644 index 0000000..eea20cb --- a/dev/null +++ b/htdocs/examples/calendar.chtml @@ -0,0 +1,101 @@ +<%impl> + /* vim:set ft=sitecing: */ + #include + #include + + + + + really simple page + + + +% /* Just call the calendar member function */ +% calendar(); + + +<%method void calendar() %> + <%code> + time_t tt = time(0); + struct tm t; + if(!localtime_r(&tt,&t)) + throw konforka::exception(CODEPOINT,"couldn't fetch current date"); + char h[16]; + if(strftime(h,sizeof(h),"%B, %Y",&t)>=sizeof(h)) + throw konforka::exception(CODEPOINT,"couldn't produce heading for the calendar"); + int today = t.tm_mday; + t.tm_mday = 1; + tt=mktime(&t); + if(!localtime_r(&tt,&t)) + throw konforka::exception(CODEPOINT,"couldn't fetch current date"); + int dim = 31; + if(t.tm_mon==3 || t.tm_mon==5 || t.tm_mon==8 || t.tm_mon==10) { + dim = 30; + }else if(t.tm_mon==1) { + dim = (t.tm_year%4)?28:29; + } + + + + + + + + + + + + + + + <%code> + int dow=0; int dom=1-t.tm_wday; + for(;;dom++,dow=(dow+1)%7) { + if(!dow) { + <%output> + + + } + bool be = (dom>=1 && dom<=dim); + std::string ec = be?" existant":" unexistant"; + if(dom==today) + ec+=" today"; + <%output> + if(dow==6) { + <%output> + + + if(dom>=dim) + break; + } + } + +
<% h %>
SunMonTueWedThuFriSat
+ if(be) { + <%output><% dom %> + } + <%output>
+ -- cgit v0.9.0.2