Welcome to the forum 👋, Guest

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

  • PËRSHËNDETJE VIZITOR!

    Nëse ju shfaqet ky mesazh do të thotë se ju nuk jeni regjistruar akoma. Anëtarët e rregjistruar kanë privilegjin të marrin pjesë në tema të ndryshme si dhe të komunikojnë me anëtarët e tjerë. Bëhu pjesë e forumit Netedy.com duke u REGJISTRUAR këtu ose nëse ke një llogari KYCU. Komunikim alternative i ketij forumi me vajza dhe djem nga te gjithe trevat shqiptare? Hyr ne: CHAT SHQIP.

[Snippets] Calendar Generator

centos

ⓃⒺⓉⒺⒹⓎ.ⒸⓄⓂ
ANETAR ✓
Regjistruar më
Dhj 13, 2004
Mesazhe
39,789
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Calendar</title>
</head>
<body>
<?php
function days_in_month($month, $year) {
    if($month!=2) {
        if($month==9||$month==4||$month==6||$month==11)
            return 30;
        else
            return 31;
    }
    else
        return $year%4==""&&$year%100!="" ? 29 : 28;
}
 
global $months;
$months = array(0 => 'January', 1 => 'February', 2 => 'March', 3 => 'April', 4 => 'May', 5 => 'June', 6 => 'July', 7 => 'August', 8 => 'September', 9 => 'October', 10 => 'November', 11 => 'December');
$days = array(0 => 'Monday', 1 => 'Tuesday', 2 => 'Wednesday', 3 => 'Thursday', 4 => 'Friday', 5 => 'Saturday', 6 => 'Sunday');
 
function render_calendar($this_year = null) {
    if($this_year==null)
        $this_year = date('Y');
    $day_of_the_month = date('N', strtotime('1 January '.$this_year));
    for($i=0;$i<=11;$i++) {
        echo "<table>
            <caption>".$GLOBALS['months'][$i]."</caption>
            <thead>
                <tr>
                    <th>Mon</th>
                    <th>Tue</th>
                    <th>Wed</th>
                    <th>Thu</th>
                    <th>Fri</th>
                    <th>Sat</th>
                    <th>Sun</th>
                </tr>
            </thead>
            <tbody>
                <tr>";
        for($n=1;$n<$day_of_the_month;$n++)
            echo "<td></td>\n";
        $days = days_in_month($i+1, $this_year);
        $day = 0;       
        while($day<$days) {
            if($day_of_the_month==8) {
                echo ($day == 0 ? "" : "</tr>\n") . "<tr>\n";
                $day_of_the_month = 1;
            }
            echo "<td style=\"border: 1px solid red;\">" . ($day+1) . "</td>\n";
            $day_of_the_month++;
            $day++;
        }
        echo "</tr>
            </tbody>
        </table>";
    }
}
 
render_calendar();
?>
</body>
</html>

Rezultati:
x0z4KPoESDW_LBuNZ6sOpA.png
 

Postime të reja

Theme customization system

You can customize some areas of the forum theme from this menu.

Choose the color combination according to your taste

Select Day/Night mode

You can use it by choosing the day and night modes that suit your style or needs.

Welcome to the forum 👋, Guest

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.