Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]miesiące po polsku
--koko--
post
Post #1





Goście







Witam, proszę o pomoc.


Jakie zmianay należy wprowadzić, aby skrypt wyświetlał nazwy miesięcy po polsku?


Kod
<?php

function Mies($year,$month,$offset)
{
    $sequence = array_pad(array(), 43, "&nbsp");
    $monthstart = getdate(mktime(0,0,0,$month,1,$year));
    $monthend = getdate(mktime(0,0,0,($month + 1),0,$year));
    
    for ($i = 1; $i <= $monthend["mday"]; $i++)
    {
        $sequence[$i + $monthstart["wday"]] = $i;
    }
    
    $monthtable  = "$offset<table>\n";
    $monthtable .= "$offset  <tr align=center>\n";
    $monthtable .= "$offset    <td colspan=7>" . $monthstart["month"] . " " . $year ."</td>\n";
    $monthtable .= "$offset  </tr>\n";
    $monthtable .= "$offset  <tr align=center>\n";
    $monthtable .= "$offset    <td>Nd</td><td>Pon</td><td>Wt</td><td>Śr</td><td>Czw</td><td>Pt</td><td>Sob</td>\n";
    $monthtable .= "$offset  </tr>\n";
    for ($i = 1; $i <= 36; $i += 7)
    {
        $monthtable .= "$offset  <tr align=right valign=bottom>\n";
        for ($day = $i; $day <= $i + 6; $day++)
        {
            $monthtable .= "$offset    <td width=25 height=10>" . $sequence[$day] . "</td>\n";
        }
        $monthtable .= "$offset  </tr>\n";
    }
    $monthtable .= "$offset</table>\n";
    
    return $monthtable;
}



function Rok($year,$cols)
{
    $validcols = array(1,2,3,4,6,12);
    if (!in_array($cols,$validcols))
    {
        $cols = 3;
    }
    $yeartable  = "<table border=1>\n";
    for ($i = 1; $i <= 12; $i += $cols)
    {
        $yeartable .= "  <tr>\n";
        for ($month = $i; $month <= $i + $cols - 1; $month++)
        {
            $yeartable .= "    <td>\n" . Mies($year,$month,"      ") . "\n    </td>\n";
        }
        $yeartable .= "  </tr>\n";
    }
    $yeartable .= "</table>\n";
    
    return $yeartable;
}


?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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>abc</title>
</head>

<body>
<p>

<?php echo Rok(2013,@cols);
?>

</p>
</body>
</html>
Go to the top of the page
+Quote Post
Mlodycompany
post
Post #2





Grupa: Zarejestrowani
Postów: 910
Pomógł: 44
Dołączył: 20.02.2008
Skąd: Łódź

Ostrzeżenie: (20%)
X----


Korzystanie z szukajki nie boli (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 10:43