The blog calendar implementation code in php shares a blog calendar implementation code in php. it is very easy to query the database, as long as you modify the field name to be the same as that in your database, the instance code is as follows:
Function calendarnew ($ starttime = 0 ){
Global $ db, $ tablepre, $ timestamp, $ site_timeoffset, $ site_dateformat, $ curtime;
$ Starttime = $ starttime? $ Starttime: $ timestamp;
$ Curtime = gmdate ($ site_dateformat, $ starttime + $ timeoffset * 3600 );
$ Pendtime = $ starttime-(gmdate ('J', $ starttime + $ timeoffset * 3600)-1) * 86400-($ starttime + $ timeoffset * 3600) % 86400;
$ Pstarttime = $ pendtime-gmdate ('t', $ pendtime + $ timeoffset * 3600-1) * 86400;
$ Nstarttime = $ pendtime + gmdate ('t', $ pendtime + $ timeoffset * 3600 + 1) * 86400;
$ Nendtime = $ nstarttime + gmdate ('t', $ nstarttime + $ timeoffset * 3600 + 1) * 86400;
List ($ skip, $ dim) = explode ('-', gmdate ('W-t', $ pendtime + $ timeoffset * 3600 + 1 ));
$ Rows = ceil ($ skip + $ dim)/7 );
$ Blogs = array ();
$ Query = $ db-> query ("SELECT dateline FROM {$ tablepre} vitaitems WHERE dateline BETWEEN '$ pendtime' AND '$ nstarttime '");
While ($ blog = $ db-> fetch_array ($ query )){
$ Day = gmdate ('J', $ blog ['Dateline '] + $ timeoffset X 3600 );
! Isset ($ blogs [$ day])? $ Blogs [$ day] = array ('num' => 1, 'Dateline '=> $ blog ['Dateline']-$ blog ['Dateline '] % 86400 ): $ blogs [$ day] ['num'] ++;
}
$ Cal = '';
For ($ row = 0; $ row <$ rows; $ row ++ ){
$ Cal. ='';
For ($ col = 0; $ col <7; $ col ++ ){
$ Cur = $ row * 7 + $ col-$ skip + 1;
$ Curtd = $ row * 7 + $ col <$ skip | $ cur> $ dim? '': $ Cur;
If (! Isset ($ blogs [$ cur]) {
$ Cal. =''. $ Curtd .'';
} Else {
$ Cal. ='. $ Uid. '& starttime = '. $ blogs [$ cur] ['Dateline ']. '& endtime = '. ($ blogs [$ cur] ['Dateline '] + 86400 ). '"title = "'. $ blogs [$ cur] ['num']. '">'. $ Cur .'';
}
}
$ Cal. = '';
}
Return $ cal;
}