PHP календар
# Ето и кода...

<style type="text/css">
table { cursor:default; font-family:Verdana, Arial; font-size:11px; color:#5f5f5f; }
a { text-decoration:none; }
a:link { color:#003F9F; }
a:visited { color:#003F9F; }
a:hover { color:#2B2D3B; }
a:active { color:#003F9F; }
</style>

<?php
if (!$_GET["calmonth"]) {
$calturnmnth = date("n");
$nxtmnthstr = $_SERVER["QUERY_STRING"];}
else {
$calturnmnth = $_GET["calmonth"];
$nxtmnthstr = preg_replace("/(&)?calmonth=\d+/","",$_SERVER["QUERY_STRING"]);}
?>

<table width="140" align="center" cellspacing="0" cellpadding="0" bgcolor="#ffffff" style="border:1pt solid #CCCCCC; border-bottom:2pt solid #CCCCCC;">
<tr>
<td align="center" colspan="0">Календар <small>(<?php echo date ("d/n/y"); ?>)</small></td>
</tr>
<tr>
<td>
<table width="90%" align="center"><tr colspan="7">
<td colspan="7" align="center">
<?php
if (($calturnmnth-1)!="0") {
echo "<a href=\"index.php?".$nxtmnthstr."&calmonth=".($calturnmnth-1)."\"><b>««</b></a> ";}
?><b><?php echo $calturnmnth."/".date("y"); ?></b><?php
if (($calturnmnth+1)!="13") {
echo " <a href=\"index.php?".$nxtmnthstr."&calmonth=".($calturnmnth+1)."\"><b>»»</b></a>";}
?>
</td>
</tr>
<tr colspan="7" style="background:#DDDDDD;">
<td width="15%" align="center"><b>П</b></td>
<td width="15%" align="center"><b>В</b></td>
<td width="15%" align="center"><b>С</b></td>
<td width="15%" align="center"><b>Ч</b></td>
<td width="15%" align="center"><b>П</b></td>
<td width="15%" align="center"><b>С</b></td>
<td width="15%" align="center"><b>Н</b></td>
</tr>
<tr colspan="7">
<?php
$caldate = $calturnmnth;
$totalday = 29;
if (preg_match("/^(1|3|5|7|8|10|12)$/",$caldate)) {
$totalday = ($totalday+3);}
if (preg_match("/^(4|6|9|11)$/",$caldate)) {
$totalday = ($totalday+2);}
if (date("L") && $caldate=="2") {
$totalday = ($totalday+1);}

if (preg_match("/^(2|3|11)$/",$caldate)) {
$startfactor = 1;}
if (preg_match("/^(6)$/",$caldate)) {
$startfactor = 2;}
if (preg_match("/^(9|12)$/",$caldate)) {
$startfactor = 3;}
if (preg_match("/^(4|7)$/",$caldate)) {
$startfactor = 4;}
if (preg_match("/^(1)$/",$caldate)) {
$startfactor = 5;}
if (preg_match("/^(5|10)$/",$caldate)) {
$startfactor = 6;}

$totalday = ($totalday+$startfactor);
$docalcount = 1;
$calendar = 1;
while ($docalcount < $totalday) {
echo "<td width=\"15%\" align=\"right\" style=\"background:#F1F1F1;\">";
if ($startfactor!=0) {
$startfactor--;}
else {
if (date("j")==$calendar && date("n")==$caldate) {
echo "<b>".$calendar."</b>";}
else {
echo $calendar;}
$calendar++;}
echo "</td>";
if (!preg_match("/\./",($docalcount/7))) {
echo "</tr><tr colspan=\"7\">";}
$docalcount++;}
?>
</tr>
</table>
</td>
</tr>
</table>



/ Трябва да сте регистриран за да напишете коментар /
От: digital_person
20:03 21-04-2010
Добро календар-че благодаря :)
1