使用PHP foreach代码填充日历

我使用以下jQuery日历: https : //github.com/MrHus/jquery-monthly-ical/tree/

在文档之后,它告诉我应该像这样输入日期:

eventdates: [{"date": "2009-03-21", "title": "My birthday", "desc": "Its my birthday!"}, {"date": "yyyy-01-01", "title": "New Year", "desc": "Its a new year!"}, {"date": "2009-mm-01", "title": "New Month", "desc": "First day of the new month!"}, {"date": "2010-mm-01", "title": "New Month", "desc": "First day of the new month!"}, {"date": "2010-09-01", "title": "Convention", "desc": "September convention."}, {"date": "2010-09-02", "title": "Convention", "desc": "September convention day two."}, {"date": "2010-mm-01", "title": "Towl", "desc": "Dont forget to bring a towl."} ] 

但是,我想用一些foreach语句用PHP变量填充上面的数组。 我有这个,但它不起作用,没有错误,没有警告,但事件没有显示:

   eventdates: [{"date": "", "title": "title ?>", "desc": "<a href="https://stackoverflow.com/questions/14798794/populating-a-calendar-with-php-foreach-code//index.php/events/get_event?id=id ?>">Details/Signups"},]  

这是日历之外的前一个代码,在我拥有的表中,它可以工作:

    active == '2') { continue; } echo ''; echo ''; echo ''; } ?> 
Date: Event: Details/Signups
'.date('n/j/Y', strtotime($event->date)).''.$event->title.'id.'">Details/Signups

代码位于.tpl文件中,该文件通过.class.php文件显示。 在其中,是运行必要变量的所有查询。

这应该这样做:

 $dates = array(); // build an array with that data foreach($events as $event) $dates[] = (object)array( 'date' => date('Y/m/d'), 'title' => $event->title, 'desc' => sprintf('Details/Signups', SITE_URL, $event->id), ); ?> eventdates: