Jump to content

Calendar code


scarface83

Recommended Posts

Hi,

 

any idea how i can get this calendar to go from april 2007 to april 2008 ?

 

Thanks

 

function generate_calender($year, $vtc_login) {
    	global $num_columns_displayed,$month_table_header,$month_row_header,$month_td_tag;
    
		$num_of_months = 12;
		$count_up = 1;

		echo $month_table_header;

	while ($count_up<=$num_of_months) {
		echo $month_row_header;

		$num_columns = $num_columns_displayed;

	while (($num_columns>0) && ($count_up<=$num_of_months)) {
		echo $month_td_tag;
		echo gen_month($year,$count_up, $vtc_login);
		echo  "</td>";

		$count_up++;
		$num_columns--;
	   
		}
		echo  "</tr>";
		}
		echo  "\n</table>";
		}

//
// Function gen_month($year,$month) will generate a month for
// the year and month given.
//
function gen_month($year,$month,$vtc_login) {
   		global $cal_table_tag,$cal_mon_tr_tag,$cal_dayname_tr_tag,$cal_day_tr_tag;
   		global $cal_event_opentd;

    		$mon_date = getdate(mktime(0,0,0,$month,1,$year));
    		$mon_name = $mon_date[month];
    		$mon_total_days = strftime( "%d",mktime(0,0,0,$month+1,0,$year));
    		echo $cal_table_tag;
    		echo $cal_mon_tr_tag .  "<td colspan=7 align=center><b>$mon_name $year</b></td></tr>";
    		echo $cal_dayname_tr_tag .  "<td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></tr>";
    		$day_count = 1;
    	

	while ($day_count<=($mon_total_days-7)) {
        	$fweek = getdate(mktime(0,0,0,$month,$day_count,$year));
        
	if ($day_count<=7) {
            $sb_cnt_td = $fweek[wday];
            $sb_cnt = $fweek[wday];
            $sb_max = 7;
            $p_line = $cal_day_tr_tag;
        

Link to comment
https://forums.phpfreaks.com/topic/49362-calendar-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.