PHP Code:
<?php
///////////////////////////////////////////////////////////////////
////// //////
////// Calendar Mod by bokli //////
////// Insprated by and based on the book //////
////// "Teach Yourself PHP4 in 24 Hours" //////
////// //////
///////////////////////////////////////////////////////////////////
// maybe you need to do at your site somewhere
//(for example to the end of your stdhead() function)
//an iframe like this:
// <iframe src='calendar.php' frameborder='0' scrolling='no'></iframe>
//and you need to design this with your .css files
//(i dont add any tips how to do, it's all up to you)
require("include/bittorrent.php");
dbconn(false);
if ($CURUSER) {
$ss_a = @mysql_fetch_array(@mysql_query("SELECT uri FROM stylesheets WHERE id=" . $CURUSER["stylesheet"]));
if ($ss_a)
$rss_uri= $ss_a["uri"];
}
if (!$ss_uri) {
$r = mysql_query("SELECT uri FROM stylesheets WHERE id=1") or sqlerr();
$a = mysql_fetch_array($r);
$ss_uri = $a["uri"];
}
$_GET["year"] = $year;
$_GET["month"] = $month;
if (!@checkdate($month, 1, $year)) {
$now = getdate();
$year = $now["year"];
$month = $now["mon"];
$today = $now["mday"];
}
$ts = mktime(0, 0, 0, $month, 1, $year);
$date = getdate($ts);
// change the first day of the week
// comment out the next four lines if you want sunday to first
if ($date["wday"] == 0)
$date["wday"] = 6;
else
$date["wday"]--;
$prevyear = $year;
$prevmonth = $month - 1;
if ($prevmonth == 0) {
$prevyear = $year - 1;
$prevmonth = 12;
}
$nextyear = $year;
$nextmonth = $month + 1;
if ($nextmonth == 13) {
$nextyear = $year + 1;
$nextmonth = 1;
}
//change the name of the months and days
//maybe you need to change these
$months = array("január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember","október", "november", "december");
//uncomment the next line (and some later) if you want to display the name of the days in the first row
$days = array("hétfĹ‘", "kedd", "szerda", "csütörtök", "péntek", "szombat", "vasárnap");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html><head>
<title>calendar</title>
<link rel="stylesheet" href="<?=$ss_uri?>" type="text/css">
</head>
<body class="calendar">
<div>
<p>
<a href="calendar.php?year=<?=$prevyear?>&month=<?=$prevmonth?>"><span class="prev"><<</span></a>
<span class="header"><?=$date["year"]?> <?=$months[$date["mon"] - 1]?></span>
<a href="calendar.php?year=<?=$nextyear?>&month=<?=$nextmonth?>"><span class="next">>></span></a>
</p>
<table>
<?
print("<tr>");
foreach ($days as $day)
print("<td class='wdays'><span>$day</span></td>");
for ($i = 0; $i < 42; $i++) {
$day_array = getdate($ts);
if (($i % 7) == 0) {
if ($day_array["mon"] != $month)
break;
if ($i != 0 || $days)
print ("</tr>\n");
print("<tr>\n");
}
if ($i < $date["wday"] || $day_array["mon"] != $month) {
print "<td></td>\n";
}
else {
if ($today && $day_array["mday"] == $today)
print "<td><strong>" . $day_array["mday"] . "</strong></td>\n";
else
print "<td>" . $day_array["mday"] . "</td>\n";
$ts += (60 * 60 * 24);
}
}
?>
</table>
</div>
</body>
</html>
would this help you if you get it to work let me know
Bookmarks