您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

数据库查查出的数据如何显示在日历中

2025/9/12 15:48:26发布38次查看
数据库查查出的数据怎么显示在日历中
我用smarty模板写的,日历按月显示
从数据库查出当月数据的日期(日),要显示在这个日历上。
现在的问题是我写了两个循环
php code//当月天数循环(比如现在是6月就是30天){section name=d loop=$dayofmonth} //数据库查出的数据记录循环 {section name=e loop=$events} //如果数据库查出的记录的日期(天day)==循环的当月天数执行如下显示 {if ($events[e].event_starttime|date_format:%d) == ($smarty.section.d.index+1)} {$events[e].event_starttime|date_format:%d} {$events[e].event_name}
{/if}{/section}//[color=#ff0000]问题现在就在这里,下面的条件3,4,6,11,12就是我从数据库查出数据的天(day),[color=#00ff00]为了不重复输出[/color],我写了下面的if判断,问题是我的月份是变化的,所以数据库查找出来的数据也是变化的,所以不可能每个月都是3,4,6,11,12。要根据数据库的数据改变,所以我的想法是下面这个if怎么改写?smarty模板里的if条件能循环?或者有其他思路?各位大虾帮忙,想了一天了[/color]{if (($smarty.section.d.index+1) != 3)&&(($smarty.section.d.index+1) != 4)&&(($smarty.section.d.index+1) != 6)&&(($smarty.section.d.index+1) != 11)&&(($smarty.section.d.index+1) != 12)}{$smarty.section.d.index+1}  {/if}//7天换一行{if ($smarty.section.d.index+$day1ofweek+1)%7==0} {/if}{/section}
------解决方案--------------------
你的数据是怎么存的?类似:
sql codeid date data1 2012-06-01 none2 2012-06-02 good3 2012-07-05 true

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product