WackoWiki: JevgeniZinovjev ...

Home Page | Изменения | Новые Комменты | Пользователи | Каталог | Регистрация | Вход:  Пароль:  

Привет всем,


Сделал небольшой Action, в виде календарика :)

calendar (Добавил: /Jevgeni Zinovjev)


Прошу проверить код на оптимизацию, если кому интересно :)
К сожалению не могу добавить файлы так что создайте файл, со следующим кодом

<?php

$curDay
=1;    

$curtxtMonth=array(
    
1    =>    "January",
    
2    =>    "February",
    
3    =>    "March",
    
4    =>    "April",
    
5    =>    "May",
    
6    =>    "June",
    
7    =>    "July",
    
8    =>    "August",
    
9    =>    "September",
    
10    =>    "October",
    
11    =>    "November",
    
12    =>    "December");       

$NOW getdate();     // get the Current server date.   
if ( $showmonth 12 || $showmonth ) { $showmonth 0$showyear 0; } 
    
if ( 
$showmonth == ) {
    
$curMonth $NOW['mon'];
} else {
    
$curMonth $showmonth;
}

if ( 
$showyear == ) {
    
$curYear $NOW['year'];
} else {
    
$curYear $showyear;
}        

$thisMonth $curMonth;
$TempMonth $NOW['month'];

$cellCount 0;

echo 
"<table cellpadding=\"1\" cellspacing=\"1\" border=\"0\">";
echo 
"<tr>";
echo 
"<th colspan=\"7\">" $curtxtMonth[$curMonth] . " - " $curYear "</th>";
echo 
"</tr>";

echo 
"<tr>";
echo 
"<th><strong>Mon&nbsp;</strong></th><th><strong>Tue&nbsp;</strong></th>";
echo 
"<th><strong>Wed&nbsp;</strong></th><th><strong>Thu&nbsp;</strong></th><th><strong>Fri&nbsp;</strong></th>";
echo 
"<th><strong>Sat&nbsp;</strong><th><strong>Sun&nbsp;</strong></th></th>";
echo 
"</tr>";

echo 
" <tr>"
    
while ( 
$curMonth == $thisMonth )
{
    
$thisMonth date "m"mktime(235959$curMonth$curDay$curYear ) );
    
$totalDays date "d"mktime 235959$curMonth$curDay 1$curYear ) );
    
$curDay++;
}      

$firstDayOfMonth date "w",mktime 000$curMonth1$curYear ) ); 

if ( 
$firstDayOfMonth == ) { $firstDayOfMonth 7; }
    
for ( 
$cellCount=1$cellCount <= $firstDayOfMonth 1$cellCount++ )
{
    echo 
"<td> </td>\r";
}  

for (
$curDay 1$curDay <= $totalDays$curDay++)
{
    if (
$cellCount == 1) { echo "<tr>\r"; }
    
$link $this->UnwrapLink$linktext $curYear . ($curMonth<10?"0":"") . $curMonth . ($curDay<10?"0":"") . $curDay );
    echo 
"<td align=center width=30>";
    if ( 
$link && isset($linktext) && !empty($linktext) ) 
    {
        echo 
$this->Link("/" $link""$curDay );
    } else {
        echo 
$curDay;
    }
    echo 
"</td>";

    
$cellCount++;

    if ( 
$cellCount == ) { echo "</tr>\r"$cellCount=1;}
}

if (
$cellCount && $cellCount 8)
{
    for (
$i=$cellCount$i<8$i++)
     {
        echo 
"<td> </td>\r";
    }

}

echo 
"</tr>\r";
echo 
"</table>";

?>


Страницы, ссылающиеся на данную: Dev/PatchesHacks/Calendar2
JevgeniZinovjev


 
Файлов нет. [Показать файлы/форму]
Комментариев нет. [Показать комментарии/форму]
Donate
Время работы: 2.589 s
Использовано памяти: 2.696 Mb