css xhtml无效
One of the website features my customers love to provider their web users is an online dynamic calendar. An online calendar can be used for events, upcoming product specials, memos, and anything else you can think of. I've taken some time to completely rewrite the PHP event calendar so that I may share it with you.
我的客户喜欢为其网站用户提供服务的网站功能之一是在线动态日历。 在线日历可以用于活动,即将推出的产品特惠,备忘录以及您能想到的其他任何东西。 我花了一些时间完全重写PHP事件日历,以便与您共享。
CSS (The CSS)
/* calendar */table.calendar { border-left:1px solid #999; }tr.calendar-row { }td.calendar-day { min-height:80px; font-size:11px; position:relative; } * html div.calendar-day { height:80px; }td.calendar-day:hover { background:#eceff5; }td.calendar-day-np { background:#eee; min-height:80px; } * html div.calendar-day-np { height:80px; }td.calendar-day-head { background:#ccc; font-weight:bold; text-align:center; width:120px; padding:5px; border-bottom:1px solid #999; border-top:1px solid #999; border-right:1px solid #999; }div.day-number { background:#999; padding:5px; color:#fff; font-weight:bold; float:right; margin:-5px -5px 0 0; width:20px; text-align:center; }/* shared */td.calendar-day, td.calendar-day-np { width:120px; padding:5px; border-bottom:1px solid #999; border-right:1px solid #999; }
The above code is complete with IE6 hacks.
上面的代码已完成IE6黑客的攻击。
PHP (The PHP)
/* draws a calendar */function draw_calendar($month,$year){ /* draw table */ $calendar = '
'.implode(' | ',$headings).' |
'; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): $calendar.= ' | '; /* add in the day number */ $calendar.= ' '.$list_day.' '; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $calendar.= str_repeat('',2); $calendar.= ' | '; if($running_day == 6): $calendar.= '
'; endfor; endif; /* final row */ $calendar.= ' |
July 2009
';echo draw_calendar(7,2009);echo 'August 2009
';echo draw_calendar(8,2009);The PHP is largely based upon one function that only requires the month and year of the calendar you'd like. It's a sizable function but obviously worth its weight in gold. Also note that I've identified a spot within the calendar where you should query the database to see if there are any events for that day. I use tables because they nicely stretch when one day in the week is longer than others. Working with absolute positioning and DIVs in the calendar is far too much hassle for a simple calendar.
PHP在很大程度上基于一个仅需要您想要的日历月份和年份的功能。 这是一个相当大的功能,但显然值得在黄金中发挥作用。 还要注意,我在日历中确定了一个位置,您应该在该位置查询数据库以查看当天是否有任何事件。 我使用表格是因为当一周中的某天长于其他时间时,它们会很好地伸展。 对于简单的日历,在日历中使用绝对定位和DIV太麻烦了。
I look forward to seeing what you can do with the calendar!
我期待看到您可以使用日历做些什么!
翻译自:
css xhtml无效