时间:2021-07-01 10:21:17 帮助过:12人阅读
//当月天数循环(比如现在是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)}
id date data 1 2012-06-01 none 2 2012-06-02 good 3 2012-07-05 true