Codice PHP:
$mesi = array('zero', 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre','dicembre');
$monthName = $mesi[(date('m', mktime(0, 0, 0, $month, 1, $year)))];
Questo espediente funziona ma quando sfoglio il calendario scorrendo i mesi, quando cambia anno mi sparisce il mese
Codice PHP:
<?php include('cp/config.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="tr" lang="tr" dir="ltr">
<head>
<title>Calendar Script</title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="robots" content="ALL" />
<meta name="robots" content="INDEX, FOLLOW" />
<meta name="robots" content="NOARCHIVE" />
<meta name="author" content="Bahadir Kocaoglu" />
<meta name="copyright" content="(C) 2007 Eggdrop Inc." />
<meta name="generator" content="Eggdrop Inc. - Free Calendar Script" />
<meta name="description" content="Eggdrop Inc. - Free Calendar Script" />
<meta name="keywords" content="calendar script" />
<style type="text/css" media="all">@import "style.css";</style>
<script language="JavaScript" type="text/javascript">
window.defaultStatus="Calendar Script";
</script>
<script type="text/JavaScript">
function popupEvent(day, month, year, w, h) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
win = window.open("popup.php?day=" + day + "&month=" + month + "&year=" + year + "","Calendar","scrollbars=yes, status=yes, location=no, toolbar=no, menubar=no, directories=no, resizable=yes, width=" + w + ", height=" + h + ", top=" + wint + ", left=" + winl + "");
if (parseInt(navigator.appVersion) >= 4) {
win.window.focus();
}
}
</script>
</head>
<body bgcolor="#55B9FF" text="#003399">
<script type="text/JavaScript">
var ol_width=140;
var ol_delay=10;
var ol_fgcolor="#FFFFFF";
var ol_bgcolor="#AAAAAA";
var ol_offsetx=10;
var ol_offsety=10;
var ol_border=1;
var ol_vauto=1;
</script>
<div id="overDiv" style="position: absolute; visibility: hidden; z-index: 1000;"></div>
<script type="text/JavaScript" src="overlib_mini.js"></script>
<center>
<?php
if (empty($_GET['month'])) {
$month = date('m');
} else {
$month = $_GET['month'];
}
if (empty($_GET['year'])) {
$year = date('Y');
} else {
$year = $_GET['year'];
}
$theday = date('w', mktime(0, 0, 0, $month, 1, $year));
$daysinmonth = date("t", mktime(0, 0, 0, $month, 1, $year));
?>
<table cellspacing="1" cellpadding="0" border="0" class="mainTable">
<tr>
<td align="center" colspan="7" class="monthRow">
[url="<?php echo $_SERVER['PHP_SELF']; if ($month == '01') { $prevmonth = '12'; $prevyear = $year - 1; echo '?month=' . $prevmonth; echo '&year=' . $prevyear; } else { $prevmonth = $month - 1; echo '?month=' . $prevmonth; echo '&year=' . $year; } ?>"]«[/url]
<?php
$mesi = array('zero', 'gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre','dicembre');
$monthName = $mesi[(date('m', mktime(0, 0, 0, $month, 1, $year)))];
$yearName = date('Y', mktime(0, 0, 0, $month, 1, $year));
echo $monthName . ' ' . $yearName;
?>
[url="<?php echo $_SERVER['PHP_SELF']; if ($month == '12') { $nextmonth = '01'; $nextyear = $year + 1; echo '?month=' . $nextmonth; echo '&year=' . $nextyear; } else { $nextmonth = $month + 1; echo '?month=' . $nextmonth; echo '&year=' . $year; } ?>"]»[/url]
</td>
</tr>
<tr class="dayNamesText">
<td class="dayNamesRow" width="25" align="center">D</td>
<td class="dayNamesRow" width="25" align="center">L</td>
<td class="dayNamesRow" width="25" align="center">M</td>
<td class="dayNamesRow" width="25" align="center">M</td>
<td class="dayNamesRow" width="25" align="center">G</td>
<td class="dayNamesRow" width="25" align="center">V</td>
<td class="dayNamesRow" width="25" align="center">S</td>
</tr>
<tr class="rows">
<?php
for ($i = 0; $i < $theday; $i++) {
?>
<td></td>
<?php
}
for ($list_day = 1; $list_day <= $daysinmonth; $list_day++) {
$tm = date("U", mktime(0, 0, 0, $month, $list_day, $year)) - 86400; // Bir gün önce
$tn = date("U", mktime(0, 0, 0, $month, $list_day, $year)); // O gün ...
$tp = date("U", mktime(0, 0, 0, $month, $list_day, $year)) + 86400; // Bir gün sonra
$Q = sprintf("SELECT * FROM `events` WHERE `date` > '%s' AND `date` < '%s' AND `day` = '%s';", $tm, $tp, $list_day);
$R = mysql_query($Q);
$D = mysql_fetch_assoc($R);
$S = mysql_num_rows($R);
$Y = $D['date'];
$TheDay = date('d', $Y);
$TheMon = date('F', $Y);
$TheYea = date('Y', $Y);
mysql_free_result($R);
if ($S) {
?>
<td align="center" onclick="popupEvent(<?php echo $D['day']; ?>, <?php echo $D['month']; ?>, <?php echo $D['year']; ?>, 400, 500)" style="background-color: #CCFF00; color: #333333; cursor: pointer;" onmouseover="return overlib('<table width="100%" border="0" cellpadding="2" cellspacing="0" class="popupDateTable"><tr><td align="center" class="popupDate"><?php echo $TheDay; ?> <?php echo $TheMon; ?> <?php echo $TheYea; ?></td></tr></table><div class="popupEventTitle s23"><?php echo $S; ?> Record(s)</div>');" onmouseout="return nd();" title="">
<?php
} elseif ($tn > $tm AND $tn < $tp AND date('j') == $list_day AND date('m') == $month AND date('Y') == $year) {
?>
<td align="center" style="background-color: #FFC18A; color: #CF0000; cursor: pointer;" onmouseover="return overlib('<div style="background-color: #FFC18A; color: #CF0000; padding: 4px;">Today</div>');" onmouseout="return nd();">
<?php
} elseif ($theday == 6 or $theday == 0) {
?>
<td align="center" style="background-color: #EEEEEE; color: #666666;">
<?php
} else {
?>
<td align="center" style="background-color: #CCCCCC; color: #333333;">
<?php
}
echo $list_day;
echo '</td>';
if ($theday == 6) {
echo '</tr>';
echo '<tr class="rows">';
$theday = -1;
}
$theday++;
}
?>
</tr>
</table>
</center>
</body>
</html>