博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css xhtml无效_使用PHP,XHTML和CSS构建日历
阅读量:2513 次
发布时间:2019-05-11

本文共 3814 字,大约阅读时间需要 12 分钟。

css xhtml无效

PHP Calendar

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 = '
'; /* table headings */ $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $calendar.= '
'; /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* row for week one */ $calendar.= '
'; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= '
'; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): $calendar.= '
'; if($running_day == 6): $calendar.= '
'; if(($day_counter+1) != $days_in_month): $calendar.= '
'; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < 8): for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= '
'; endfor; endif; /* final row */ $calendar.= '
'; /* end the table */ $calendar.= '
'.implode(' ',$headings).'
  '; /* 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.= '
 
'; /* all done, return result */ return $calendar;}/* sample usages */echo '

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无效

转载地址:http://qkpwd.baihongyu.com/

你可能感兴趣的文章
sk_buff Structure
查看>>
oracle的级联更新、删除
查看>>
多浏览器开发需要注意的问题之一
查看>>
Maven配置
查看>>
HttpServletRequest /HttpServletResponse
查看>>
SAM4E单片机之旅——24、使用DSP库求向量数量积
查看>>
从远程库克隆库
查看>>
codeforces Unusual Product
查看>>
hdu4348 - To the moon 可持久化线段树 区间修改 离线处理
查看>>
springMVC中一个class中的多个方法
查看>>
cxx signal信号捕获
查看>>
《Android开发艺术探索》读书笔记——Cha3.2.3改变布局参数实现View的滑动
查看>>
python闭包与装饰器
查看>>
Acegi 源码解释
查看>>
Activity的几种启动跳转方式
查看>>
LCA最近公共祖先Tarjan(离线)
查看>>
牛客练习赛16 E求值
查看>>
matlab rank
查看>>
Asp.net系列--基础篇(三)
查看>>
css基础
查看>>